Source

HH-Courses / views.py

Full commit
from django.shortcuts import render_to_response
from django.contrib.sites.models import Site
from django.template import RequestContext
from models import Courses, Lessons
from managers import ActiveCourses, ActiveLessons

def course_index(request):
    current_site = Site.objects.get_current()
    courses_list = Courses.active.filter(sites=current_site.id)
    
    return render_to_response('courses_index.html', locals(),context_instance=RequestContext(request))

def course_detail(request, slug):
    try:
            c = Courses.active.get(slug=slug)
    except Courses.DoesNotExist:
            raise Http404
    return render_to_response('course_detail.html', locals(),context_instance=RequestContext(request))
        
def lesson_detail(request, slug):
    try:
            l = Lessons.active.get(slug=slug)
    except Lessons.DoesNotExist:
            raise Http404
    return render_to_response('lesson_detail.html', locals(),context_instance=RequestContext(request))