{% macro render_field(field) %} {% if field.type == 'BooleanField' %} {{ render_boolean_field(field, *args, **kwargs) }} {% elif field.type == 'FileField' %} {{ render_file_field(field, *args, **kwargs) }} {% elif field.type == 'IntegerField' %} {{ render_integer_field(field, *args, **kwargs) }} {% elif field.type == 'MultipleFileField' %} {{ render_multiple_file_field(field, *args, **kwargs) }} {% elif field.type == 'SubmitField' %} {{ render_submit_field(field, *args, **kwargs) }} {% elif field.type == 'TextAreaField' %} {{ render_text_area_field(field, *args, **kwargs) }} {% else %} {{ render_generic_field(field, *args, **kwargs) }} {% endif %} {% endmacro %} {% macro render_boolean_field(field) %}
{% endmacro %} {% macro render_file_field(field) %} {% set placeholder = kwargs.pop('placeholder', '') %}
{{ field.label.text }}
{% for error in field.errors %} {{ error }} {% endfor %}
{% endmacro %} {% macro render_multiple_file_field(field) %} {% set placeholder = kwargs.pop('placeholder', '') %}
{{ field.label.text }}
{% for error in field.errors %} {{ error }} {% endfor %}
{% endmacro %} {% macro render_integer_field(field) %}
{% if 'material_icon' in kwargs %} {{ kwargs.pop('material_icon') }} {% endif %} {% for error in field.errors %} {{ error }} {% endfor %}
{% endmacro %} {% macro render_submit_field(field) %} {% endmacro %} {% macro render_text_area_field(field) %}
{% if 'material_icon' in kwargs %} {{ kwargs.pop('material_icon') }} {% endif %} {% for error in field.errors %} {{ error }} {% endfor %}
{% endmacro %} {% macro render_generic_field(field) %} {% set classes_ = kwargs.pop('class_', '').split(' ') %} {% if 'validate' not in classes_ %} {% set _ = classes_.append('validate') %} {% endif %} {% set _ = kwargs.update({'class_': ' '.join(classes_)}) %}
{% if 'material_icon' in kwargs %} {{ kwargs.pop('material_icon') }} {% endif %} {{ field(*args, **kwargs) }} {{ field.label }} {% for error in field.errors %} {{ error }} {% endfor %}
{% endmacro %}