View for list of catalogs
[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\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 library_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/library_view.html', context_instance = context)