{% macro render_checkbox(field) %}
{{ field.description }} {% if field.errors -%} {% for error in field.errors -%} {{ error|e }} {%- endfor %} {%- endif %}
{% endmacro%} {% macro render_radio(field) %}
{{ field.label(class_="control-label") }}
{% for subfield in field -%} {%- endfor %} {{ field.description }} {% if field.errors -%} {% for error in field.errors -%} {{ error }} {%- endfor %} {%- endif %}
{% endmacro %} {% macro render_datepicker(field) %}
{{ field() }} {{ field.description }} {% if field.errors -%} {% for error in field.errors -%} {{ error }} {%- endfor %} {%- endif %}
{% endmacro %} {% macro render_textarea(field) %}
{{ field(class="span6", rows="5") }} {{ field.description }} {% if field.errors -%} {% for error in field.errors -%} {{ error }} {%- endfor %} {%- endif %}
{% endmacro %} {% macro render_input(field) %}
{{ field }} {{ field.description }} {% if field.errors -%} {% for error in field.errors -%} {{ error }} {%- endfor %} {%- endif %}
{% endmacro %} {% macro render_action(field) %}
{{ field(class_="btn btn-primary") }}
{% endmacro %} {% macro render_form(url, form, horizontal=False, legend=None, confirm_msg=None, formid=None) %} {% set idattr = "id=" + formid if formid else "" %}
{{ form.hidden_tag() }}
{% if legend %} {{ legend|safe }} {% endif %} {% set focus = True %} {% for field in form %} {% if field.type != "HiddenField" and field.type != "CSRFTokenField" %} {% if field.type == "RadioField" %} {{ render_radio(field) }} {% elif field.type == "BooleanField" %} {{ render_checkbox(field) }} {% elif field.type == "SubmitField" %} {{ render_action(field) }} {% elif field.type == "TextAreaField" %} {{ render_textarea(field) }} {% elif field.type == "DateField" %} {{ render_datepicker(field) }} {% elif field.type == "TextField" %} {% if focus %} {{ render_input(field) }} {% set focus = False %} {% else %} {{ render_input(field) }} {% endif %} {% else %} {{ render_input(field) }} {% endif %} {% endif %} {% endfor %}
{% endmacro %}