Exemple #1
0
def index(template_id: int):
    template: Template = get_or_404(
        db.session.query(Template).filter_by(id=template_id))
    template_schema = TemplateSchema(session=db.session)
    stylesheet_schemas = StylesheetSchema(session=db.session, many=True)
    return render_template(
        "sites/edit_template.html",
        template_json=template_schema.dumps(template),
        stylesheets_json=stylesheet_schemas.dumps(template.styles),
    )
Exemple #2
0
def index(document_id: int):
    document: Document = get_or_404(
        db.session.query(Document).filter_by(id=document_id)
    )
    doc_schema = DocumentSchema(session=db.session, instance=document)
    var_schemas = VariableSchema(session=db.session, many=True)
    template_schema = TemplateSchema(session=db.session)
    stylesheet_schemas = StylesheetSchema(session=db.session, many=True)
    return render_template(
        "sites/edit.html",
        document_id=document_id,
        document_json=doc_schema.dumps(document),
        variable_json=var_schemas.dumps(document.variables, many=True),
        template_json=template_schema.dumps(document.template),
        stylesheets_json=stylesheet_schemas.dumps(document.template.styles),
    )