slightly prettier annotation links (#677)
[wolnelektury.git] / apps / lessons / views.py
1 # -*- coding: utf-8 -*-
2 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
3 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
4 #
5 from django.views.generic.list_detail import object_detail
6 from catalogue import forms
7 from lessons import models
8
9
10 def document_detail(request, slug):
11     template_name = 'lessons/document_detail.html'
12     if request.is_ajax():
13         template_name = 'lessons/ajax_document_detail.html'
14
15     return object_detail(request,
16         slug=slug,
17         slug_field='slug',
18         queryset=models.Document.objects.all(),
19         template_name=template_name,
20         extra_context={
21             'form': forms.SearchForm(),
22         })