{% macro field_datetime(field) %}
{%- endmacro %} {# https://raw.githubusercontent.com/mbr/flask-bootstrap/master/flask_bootstrap/templates/bootstrap/wtf.html #} {% macro form_errors(form, hiddens=True) %} {%- if form.errors %} {%- for fieldname, errors in form.errors.items() %} {%- if is_hidden(form[fieldname]) and hiddens or not is_hidden(form[fieldname]) and hiddens != 'only' %} {%- for error in errors %}

{{error}}

{%- endfor %} {%- endif %} {%- endfor %} {%- endif %} {%- endmacro %} {% macro _hz_form_wrap(horizontal_columns, form_type, add_group=False, required=False) %} {% if form_type == "horizontal" %} {% if add_group %}
{% endif %}
{% endif %} {{caller()}} {% if form_type == "horizontal" %} {% if add_group %}
{% endif %}
{% endif %} {% endmacro %} {% macro required_label(field) %} {%- if is_required(field) -%} * {%- endif %} {% endmacro %} {% macro form_field(field, form_type="basic", field_opts={}, horizontal_columns=('lg', 2, 10), button_map={}) %} {% if field.flags.required and not required in kwargs %} {% set kwargs = dict(required=True, **kwargs) %} {% endif %} {% if field.widget.input_type == 'checkbox' %} {% call _hz_form_wrap(horizontal_columns, form_type, True, required=required) %}
{% endcall %} {%- elif field.type == 'RadioField' -%} {% call _hz_form_wrap(horizontal_columns, form_type, True, required=required) %} {% if 'radio-inline' in field_opts.get('class', {}) %} {# Affiche les champs radio l'un a cote de l'autre #}
{% for item in field -%} {% endfor %}
{% else %} {% for item in field -%}
{% endfor %} {% endif %} {% endcall %} {%- elif field.type == 'SubmitField' -%} {% call _hz_form_wrap(horizontal_columns, form_type, True, required=required) %} {{field(class='btn btn-%s' % button_map.get(field.name, 'default'), **kwargs)}} {% endcall %} {%- elif field.type == 'FormField' -%}
{{field.label}} {%- for subfield in field %} {% if not is_hidden(subfield) -%} {{ form_field(subfield, form_type=form_type, field_opts=field_opts, horizontal_columns=horizontal_columns, button_map=button_map) }} {%- endif %} {%- endfor %}
{% else -%}
{%- if form_type == "inline" %} {{ field.label(class="sr-only")|safe }} {% if field.type == 'FileField' %} {{field(**kwargs)|safe}} {% else %} {{field(class="form-control", **kwargs)|safe}} {% endif %} {% elif form_type == "horizontal" %}
{% if field.type == 'FileField' %} {{field(**kwargs)|safe}} {% else %} {{field(class="form-control", **kwargs)|safe}} {% endif %}
{%- if field.errors %} {%- for error in field.errors %} {% call _hz_form_wrap(horizontal_columns, form_type, required=required) %}

{{error}}

{% endcall %} {%- endfor %} {%- elif field.description -%} {% call _hz_form_wrap(horizontal_columns, form_type, required=required) %}

{{field.description|safe}}

{% endcall %} {%- endif %} {%- else -%} {{field.label(class="control-label")|safe}} {{field(class="form-control", **kwargs)|safe}} {%- if field.errors %} {%- for error in field.errors %}

{{error}}

{%- endfor %} {%- elif field.description -%}

{{field.description|safe}}

{%- endif %} {%- endif %}
{% endif %} {% endmacro %} {# valid form types are "basic", "inline" and "horizontal" #} {% macro quick_form(form, action="", method="post", extra_classes=None, role="form", form_type="basic", horizontal_columns=('lg', 2, 10), enctype=None, button_map={}, id="") %}
{{ form.hidden_tag() }} {{ form_errors(form, hiddens='only') }} {#% set form_opts = attr(form, '_form_opts') or {} %#} {%- for field in form %} {% if not is_hidden(field) -%} {{ form_field(field, form_type=form_type, field_opts={}, horizontal_columns=horizontal_columns, button_map=button_map) }} {#field_opts=form_opts.get(field.name, {}),#} {%- endif %} {%- endfor %}
{%- endmacro %} {% macro flashed_messages(messages=None, container=True) -%} {% with messages = messages or get_flashed_messages(with_categories=True) -%} {% if messages -%} {# don't output anything if there are no messages #} {% if container -%}
{% endif -%} {% for cat, msg in messages %} {% endfor -%} {% if container %}
{% endif -%} {% endif -%} {% endwith -%} {% endmacro -%} {% macro icon(type=None, extra_classes=[]) -%} {%- endmacro %} {% macro form_button(url, content, method='post', class='btn-link') -%}
{%- endmacro %} {% macro render_pagination(pagination, endpoint=None, prev=('«')|safe, next=('»')|safe, size=None, ellipses='…') -%} {% with endpoint = endpoint or request.endpoint %} {% endwith %} {% endmacro %} {% macro panel_begin(title) %}

{{title}}

{% endmacro %} {% macro panel_end() %}
{% endmacro %} {% macro panel_caller(title, panel_id) %}

{{title}}

{{ caller() }}
{% endmacro %} {% macro accordion_tag(id, label, open) %}
{% if open %}
{% else %}
{% endif %}
{{ caller() }}
{% endmacro %}