Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
# -*- 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