-#def pull_requests(request):
-# return direct_to_template(request, 'manager/pull_request.html', extra_context = {
-# 'objects': models.PullRequest.objects.all()} )
+def pull_requests(request):
+ objects = PullRequest.objects.order_by('-status', 'timestamp')
+
+ if not request.user.has_perm('explorer.book.can_share'):
+ objects = objects.filter(comitter=request.user)
+
+ return direct_to_template(request, 'manager/pull_request.html',
+ extra_context = {'objects': objects} )
+
+
+#
+# Testing
+#
+def renderer_test(request):
+ 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