use jinja's built in tojson
filter
This commit is contained in:
parent
c45e643522
commit
0df7c0f56a
@ -50,8 +50,6 @@ def mixedContentToJson(value):
|
|||||||
value["task_order"] = value["task_order"].filename
|
value["task_order"] = value["task_order"].filename
|
||||||
return app.jinja_env.filters["tojson"](value)
|
return app.jinja_env.filters["tojson"](value)
|
||||||
|
|
||||||
def toJson(data):
|
|
||||||
return json.dumps(data)
|
|
||||||
|
|
||||||
def register_filters(app):
|
def register_filters(app):
|
||||||
app.jinja_env.filters["iconSvg"] = iconSvg
|
app.jinja_env.filters["iconSvg"] = iconSvg
|
||||||
@ -60,4 +58,3 @@ def register_filters(app):
|
|||||||
app.jinja_env.filters["readableInteger"] = readableInteger
|
app.jinja_env.filters["readableInteger"] = readableInteger
|
||||||
app.jinja_env.filters["getOptionLabel"] = getOptionLabel
|
app.jinja_env.filters["getOptionLabel"] = getOptionLabel
|
||||||
app.jinja_env.filters["mixedContentToJson"] = mixedContentToJson
|
app.jinja_env.filters["mixedContentToJson"] = mixedContentToJson
|
||||||
app.jinja_env.filters["toJson"] = toJson
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
{% macro Selector(field, default_label='Select an option') -%}
|
{% macro Selector(field, default_label='Select an option') -%}
|
||||||
|
|
||||||
<selector
|
<selector
|
||||||
v-bind:choices='{{ field.choices | toJson }}'
|
v-bind:choices='{{ field.choices | tojson }}'
|
||||||
default-label='{{ default_label }}'
|
default-label='{{ default_label }}'
|
||||||
{% if field.data %}initial-choice='{{ field.data }}'{% endif %}
|
{% if field.data %}initial-choice='{{ field.data }}'{% endif %}
|
||||||
{% if field.errors %}v-bind:initial-errors='{{ field.errors }}'{% endif %}
|
{% if field.errors %}v-bind:initial-errors='{{ field.errors }}'{% endif %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user