# Create your views here.
from django.shortcuts import render_to_response
from studyplanner.courselist.models import Course
from studyplanner.courselist.models import Faculty
from studyplanner.courselist.models import Department

def list_courses(request, faculty, department):
    department = Department.objects.get(slug=department)
    courses = department.courses.all()
    return render_to_response('list_courses.html', {
        'department': department, 'courses': courses})

def list_faculties(request):
    faculties = Faculty.objects.all()
    return render_to_response('list_faculties.html', {'faculties': faculties})

def list_departments(request, faculty):
    faculty = Faculty.objects.get(slug=faculty)
    departments = faculty.departments.all()
    return render_to_response('list_departments.html', {
        'faculty': faculty, 'departments': departments})

def show_course(request, faculty, department, course):
    faculty = Faculty.objects.get(slug=faculty)
    department = Department.objects.get(slug=department)
    course = Course.objects.get(slug=course)
    return render_to_response('show_course.html', {
        'faculty': faculty, 'department': department, 'course': course})

@@ -411,33 +411,54 @@
 courses.html', %7B
+'user': request.user,
 %0A
-
         'departm
@@ -618,16 +618,46 @@
 html', %7B
+'user': request.user,%0A        
 'faculti
@@ -854,32 +854,53 @@
 rtments.html', %7B
+'user': request.user,
 %0A        'facult
@@ -1147,16 +1147,16 @@
 course)%0A
-
     retu
@@ -1198,16 +1198,37 @@
 html', %7B
+'user': request.user,
 %0A       

Add user object to template context.