{%- if _ is not defined -%} {% macro _(message) -%} {{ message }} {%- endmacro %} {%- endif -%} {# Renders field for bootstrap 4 standards. Params: field - WTForm field kwargs - pass any arguments you want in order to put them into the html attributes. There are few exceptions: for - for_, class - class_, class__ - class_ Example usage: {{ horz_form.field(form.email, placeholder='Input email', type='email') }} Note: A change was made to the below macros to support adding tab indexes to form elements. A tab index can be added explicitly as a html attribute when creating a field but we wanted to add the tab indexes when a wtform is created using the form macro, fields macro or the sections macro. Due to the fact that some of these macros can be used multiple times in a template, we needed a way to specify the start tab index for each invocation of the macro. We do that by passing in the start_tab_index parameter to the form, fields and section macros. This change could possibly cause tab indexes to be incorrect for existing forms if some form fields are being rendered explicity inside a form macro. The tab indexes would be incorrect because by default, the start_tab_index in the form macro is set to 1 and the same index is then used to set the tab index on the form submit buttons. To fix the tab indexes, the parameter start_tab_index in the form macro will need to be set so to account for all the fields which are being explicitly rendered. #} {% macro div_form_group(field) -%}
{{ e }}
{% endfor %} {% elif field.flags.required %}This field is required.
{% endif %}{{ e }}
{% endfor %}