python - Setting Flask dictionary value via Jinja -


if use following in jinja template:

{% set data['enabled'] = true %} 

i receive error templatesyntaxerror: expected token '=', got '['. setting 1 word variables fine, error states, setting dictionary values through jinja brings error.

is there workaround issue? thanks.

jinja2 tries limit assignments in code remove logic view (check out mvc explanation).

if still want assignment have use update block. have enable expression statements. after can try this:

{% data.update({'enabled':'true'}) %} 

Comments