def show_small(request, pid, doc=None): """Render a document's details.""" if doc is None: storage = request.project.get_storage() doc = storage.get(pid) template = "documents/includes/document.html" return render(request, template, dict(object=doc))
def show_small(request, pid, doc=None): """Render a document's details.""" if doc is None: storage = request.project.get_storage() doc = storage.get(pid) template = "documents/includes/document.html" return render(request, template, dict(object=doc))
def delete_multiple(request): # fixme, figure out how to do the post # properly if request.method == "POST": pids = request.GET.getlist("pid") storage = request.project.get_storage() print "Deleting %s" % pids [storage.get(pid).delete() for pid in pids] if request.is_ajax(): return HttpResponse(json.dumps({"ok": True}), mimetype="application/json") return render(request, "document/delete.html", dict(object=doc))
def delete_multiple(request): # fixme, figure out how to do the post # properly if request.method == "POST": pids = request.GET.getlist("pid"); storage = request.project.get_storage() print "Deleting %s" % pids [storage.get(pid).delete() for pid in pids] if request.is_ajax(): return HttpResponse(json.dumps({"ok": True}), mimetype="application/json") return render(request, "document/delete.html", dict(object=doc))
def editor(request, pid=None): """Edit document transcript.""" context = {} if pid is not None: storage = request.project.get_storage() doc = storage.get(pid) context = dict(next=storage.next(pid), prev=storage.prev(pid), doc=doc) if not request.is_ajax(): template = "documents/editor.html" return render(request, template, context) # if it's an Ajax request, write the document text to the # response response = HttpResponse(mimetype="application/json") json.dump(context, response, cls=DocumentEncoder) return response
def editor(request, pid=None): """Edit document transcript.""" context = {} if pid is not None: storage = request.project.get_storage() doc = storage.get(pid) context = dict( next=storage.next(pid), prev=storage.prev(pid), doc=doc) if not request.is_ajax(): template = "documents/editor.html" return render(request, template, context) # if it's an Ajax request, write the document text to the # response response = HttpResponse(mimetype="application/json") json.dump(context, response, cls=DocumentEncoder) return response
def delete(request, pid): storage = request.project.get_storage() doc = storage.get(pid) return render(request, "document/delete.html", dict(object=doc))
def delete(request, pid): storage = request.project.get_storage() doc = storage.get(pid) return render(request, "document/delete.html", dict(object=doc))