fixes to vierwer/folding catalogue in menu
[wolnelektury.git] / apps / libraries / views.py
1 from django.shortcuts import render_to_response, get_object_or_404\r
2 from django.template import RequestContext, Template, TemplateSyntaxError\r
3 \r
4 from libraries.models import Catalog, Library\r
5 \r
6 \r
7 def main_view(request):\r
8     context = RequestContext(request)\r
9     context['catalogs'] = Catalog.objects.all()\r
10     return render_to_response('libraries/main_view.html', context_instance = context)\r
11 \r
12 def catalog_view(request, slug):\r
13     context = RequestContext(request)\r
14     context['catalog'] = get_object_or_404(Catalog.objects.filter(slug = slug).select_related())\r
15     return render_to_response('libraries/catalog_view.html', context_instance = context)\r
16     \r
17 def library_view(request, catalog_slug, slug):\r
18     context = RequestContext(request)\r
19     context['library'] = get_object_or_404(Library.objects.filter(slug = slug).filter(catalog__slug = catalog_slug))\r
20     return render_to_response('libraries/library_view.html', context_instance = context)