{%- macro form_errors(form) %} {%- if form.errors %} {%- for fieldname, errors in form.errors.items() %} {%- if bootstrap_is_hidden_field(form[fieldname]) %} {%- for error in errors %}

{{error}}

{%- endfor %} {%- endif %} {%- endfor %} {%- endif %} {%- endmacro %} {%- macro form_field_errors(field) %} {%- if field.errors %} {%- for error in field.errors %}

{{ error }}

{%- endfor %} {%- endif %} {%- endmacro %} {%- macro form_fields(fields, prepend='', append='', label=True) %} {%- set width = (12 / fields|length)|int %}
{%- for field in fields %}
{%- if field is iterable %} {%- for subfield in field %} {{ form_individual_field(subfield, prepend=prepend, append=append, label=label, **kwargs) }} {%- endfor %} {%- else %} {{ form_individual_field(field, prepend=prepend, append=append, label=label, **kwargs) }} {%- endif %}
{%- endfor %}
{%- endmacro %} {%- macro form_individual_field(field, prepend='', append='', label=True, class_="") %} {%- if field.type == "BooleanField" %} {{ field(**kwargs) }}  {{ field.label if label else '' }} {%- else %} {{ field.label if label else '' }}{{ form_field_errors(field) }} {%- if prepend %}
{%- elif append %}
{%- endif %} {{ prepend|safe }}{{ field(class_=("form-control " + class_) if class_ else "form-control", **kwargs) }}{{ append|safe }} {%- if prepend or append %}
{%- endif %} {%- endif %} {%- endmacro %} {%- macro form_field(field) %} {%- if field.type == 'SubmitField' %} {{- form_fields((field,), label=False, class="btn btn-default", **kwargs) }} {%- else %} {{- form_fields((field,), **kwargs) }} {%- endif %} {%- endmacro %} {%- macro form(form) %}
{{ form.hidden_tag() }} {%- for field in form %} {%- if bootstrap_is_hidden_field(field) %} {{ field() }} {%- else %} {{ form_field(field) }} {%- endif %} {%- endfor %}
{%- endmacro %} {%- macro card(title=None, theme="primary", header=True) %}
{%- if header %}
{%- if title %}

{{ title }}

{%- endif %}
{%- endif %}
{{- caller() }}
{%- endmacro %} {%- macro table(title=None, theme="primary", datatable=True) %}
{%- if title %}

{{ title }}

{%- endif %}
{{- caller() }}
{%- endmacro %} {%- macro fieldset(title=None, field=None, enabled=None, fields=None) %} {%- if field or title %} {%- if field %} {{ form_individual_field(field) }} {%- else %} {{ title }} {%- endif %} {%- endif %} {{- caller() }} {%- if fields %} {%- set kwargs = {"enabled" if enabled else "disabled": ""} %} {%- for field in fields %} {{ form_field(field, **kwargs) }} {%- endfor %} {%- endif %} {%- endmacro %} {%- macro clip(target, title=_("copy to clipboard"), icon="copy", color="primary", action="copy") %} {%- endmacro %}