- return direct_to_template(request, 'renderer.html', mimetype="application/xhtml+xml",
- extra_context = {} )
\ No newline at end of file
+ return direct_to_template(request, 'renderer.html', mimetype="text/html",
+ extra_context = {} )
+
+
+def document_gallery(request, document):
+ assocs = models.GalleryForDocument.objects.filter(document=document)
+ directory = assocs[0].subpath
+ try:
+ images = ['/media/%s/%s' % (directory, f) for f in os.listdir(os.path.join(settings.MEDIA_ROOT, directory)) if f.lower().endswith('.jpg')]
+ return HttpResponse(json.dumps(images))
+ except IndexError:
+ raise Http404