Setting data attributes in WTForms field
I want to add "data-" attributes to a form field for integration with Bootstrap. I tried the following in a template:
{{ form.test(data-toggle="toggle", data-size="mini", data-on="Yes", data-off="No", type="checkbox")}}
and got this error:
TemplateSyntaxError: expected token ',', got '='
Why did I get this error and how can I fix it?
+3
source to share
1 answer