X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/ae60b2a3949e96357477cc04f90fd0873cee8a92..397ba7adb8e974384f33f53dd0ee230374cce80a:/src/libraries/views.py?ds=inline diff --git a/src/libraries/views.py b/src/libraries/views.py index ab4b4b76f..1d15797ce 100644 --- a/src/libraries/views.py +++ b/src/libraries/views.py @@ -1,26 +1,22 @@ -# -*- coding: utf-8 -*- -# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later. -# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. -# -from django.shortcuts import render_to_response, get_object_or_404 -from django.template import RequestContext - -from libraries.models import Catalog, Library - - -def main_view(request): - context = RequestContext(request) - context['catalogs'] = Catalog.objects.all() - return render_to_response('libraries/main_view.html', context_instance=context) - - -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) +# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later. +# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. +# +from django.shortcuts import render, get_object_or_404 +from libraries.models import Catalog, Library + + +def main_view(request): + return render(request, 'libraries/main_view.html', { + "catalogs": Catalog.objects.all(), + }) + + +def catalog_view(request, slug): + return render(request, 'libraries/catalog_view.html', { + "catalog": get_object_or_404(Catalog.objects.filter(slug=slug).select_related()), + }) + +def library_view(request, catalog_slug, slug): + return render(request, 'libraries/library_view.html', { + "library": get_object_or_404(Library.objects.filter(slug=slug).filter(catalog__slug=catalog_slug)), + })