from flask import (Module) from flaskcma.stories.documents import Story mod = Module(__name__, name="stories") mod.flaskcma = { 'content_list': [Story] }
if content is None: content = Document() Form = content.admin_form() if Form is None: abort(404) # We can't edit this content item form = Form(request.forms, instance=content) if request.method == "post" and form.validate(): doc = form.save() redirect(doc.path) return render_template("content.html", content=content, admin_form=form) @mod.route("/<path>/") def content_detail(path): path = "/%s/" % (path,) content = Content.objects(path=path).first() if content is None: abort(404) return render_template("content.html", content=content) # Register these documents with flaskcma mod.flaskcma = {"content_list": [Content]}