X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/80b56e4c5f668a8011bdf859504d45b7b7f6d914..8ab99005ed40c0646e65d2857acc5ce48b54c82d:/apps/libraries/views.py?ds=sidebyside diff --git a/apps/libraries/views.py b/apps/libraries/views.py index baf7baaf4..f79f2a1ea 100644 --- a/apps/libraries/views.py +++ b/apps/libraries/views.py @@ -1,7 +1,7 @@ from django.shortcuts import render_to_response, get_object_or_404 from django.template import RequestContext, Template, TemplateSyntaxError -from libraries.models import Catalog +from libraries.models import Catalog, Library def main_view(request): @@ -9,7 +9,12 @@ def main_view(request): context['catalogs'] = Catalog.objects.all() return render_to_response('libraries/main_view.html', context_instance = context) -def library_view(request, slug): +def catalog_view(request, slug): context = RequestContext(request) context['catalog'] = get_object_or_404(Catalog.objects.filter(slug = slug).select_related()) + return render_to_response('libraries/catalog_view.html', context_instance = context) + +def library_view(request, catalog_slug, slug): + context = RequestContext(request) + context['library'] = get_object_or_404(Library.objects.filter(slug = slug).filter(catalog__slug = catalog_slug)) return render_to_response('libraries/library_view.html', context_instance = context) \ No newline at end of file