+ return render_to_response("picture/picture_viewer.html", {
+ 'picture': picture,
+ 'sponsors': sponsors,
+ }, context_instance=RequestContext(request))
+
+
+@ajax(method='get')
+def picture_page(request, key=None):
+ pictures = Picture.objects.order_by('-id')
+ if key is not None:
+ pictures = pictures.filter(id__lt=key)
+ pictures = pictures[:settings.PICTURE_PAGE_SIZE]
+ picture_data = [
+ {
+ 'id': picture.id,
+ 'title': picture.title,
+ 'author': picture.author_unicode(),
+ 'epoch': picture.tag_unicode('epoch'),
+ 'kind': picture.tag_unicode('kind'),
+ 'genre': picture.tag_unicode('genre'),
+ 'style': picture.extra_info['style'],
+ 'image_url': picture.image_file.url,
+ 'width': picture.width,
+ 'height': picture.height,
+ }
+ for picture in pictures
+ ]
+ return {
+ 'pictures': picture_data,
+ 'count': Picture.objects.count(),
+ }