Fix section counting/targetting from search snippet
[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 lessons import models
7
8
9 def document_detail(request, slug):
10     template_name = 'lessons/document_detail.html'
11     if request.is_ajax():
12         template_name = 'lessons/ajax_document_detail.html'
13
14     return object_detail(request,
15         slug=slug,
16         slug_field='slug',
17         queryset=models.Document.objects.all(),
18         template_name=template_name,
19     )