1 # This file is part of Wolne Lektury, licensed under GNU Affero GPLv3 or later.
2 # Copyright © Fundacja Wolne Lektury. See NOTICE for more information.
4 from django.shortcuts import render, get_object_or_404
5 from django.template import RequestContext, Template, TemplateSyntaxError
7 from infopages.models import InfoPage
10 def infopage(request, slug):
11 if request.user.is_staff:
12 page = get_object_or_404(InfoPage, slug=slug)
14 page = get_object_or_404(InfoPage, slug=slug, published=True)
16 rc = RequestContext(request)
18 left_column = Template(page.left_column).render(rc)
19 except TemplateSyntaxError:
23 right_column = Template(page.right_column).render(rc)
24 except TemplateSyntaxError:
29 'infopages/infopage.html',
32 'left_column': left_column,
33 'right_column': right_column,
34 'active_menu_item': f'info:{slug}',