Skip to content

Instantly share code, notes, and snippets.

@trojkat
Created February 5, 2012 22:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trojkat/1748181 to your computer and use it in GitHub Desktop.
Save trojkat/1748181 to your computer and use it in GitHub Desktop.
# -*- 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