2 from django.conf import settings
3 from django.views.generic import DetailView, ListView
4 from .models import Lesson, Section
5 from curriculum.models import Level
6 from publishers.models import Publisher
9 class LessonListView(ListView):
10 queryset = Level.objects.exclude(lesson=None)
11 template_name = "catalogue/lesson_list.html"
13 def get_context_data(self, **kwargs):
14 context = super(LessonListView, self).get_context_data(**kwargs)
15 context['appendix'] = Lesson.objects.filter(type='appendix')
19 class LessonView(DetailView):
22 def get_template_names(self):
24 'catalogue/lesson/%s/lesson_detail.html' % self.object.type,
25 'catalogue/lesson/lesson_detail.html',
28 def get_context_data(self, **kwargs):
29 context = super(LessonView, self).get_context_data(**kwargs)
31 context['publisher'] = Publisher.objects.get(
32 name=context['object'].dc.get('publisher', '').strip())