I'm using jinja to render a flask-wtf submit button as follows:
{{ wtf.form_field(form.submit) }}
This results in a button formatted in btn-default bootstrap format (white). I'd like to change this to btn-success bootstrap format (green).
How can I achieve this?
As suggested by @dpgaspar the solution was to use button_map as follows:
{{ wtf.form_field(form.submit, button_map={'submit':'success'}) }}
If you are using wtf.quick_form, use the form like this.
{{ wtf.quick_form(form, button_map={'submit':'success'}) }}
I presume you are also using flask-bootstrap.
On the flask-bootstrap Jinja2 macros you have:
{% call _hz_form_wrap(horizontal_columns, form_type, True, required=required) %}
{{field(class='btn btn-%s' % button_map.get(field.name, 'default'), **kwargs)}}
{% endcall %}
You should use if you can the button_map to do it [see details in comments below]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With