Created
February 5, 2012 22:20
-
-
Save trojkat/1748181 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from django.template import Context, loader | |
from gallery.models import Album | |
def parse(kwargs): | |
id = kwargs.get('numer') | |
title = kwargs.get('tytul', True) | |
if title == 'brak': | |
title = False | |
if not id.isdigit(): | |
return "[Nieporawny numer galerii]" | |
try: | |
album = Album.objects.get(id=id, public=True) | |
except Album.DoesNotExist: | |
return "[Nie ma takiej galerii lub jest nieopublikowana]" | |
template = loader.get_template('gallery/album-embedded.html') | |
context = Context({ | |
'title': title, | |
'album': album, | |
}) | |
return template.render(context) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment