added tmeplate macros and base template for forms

This commit is contained in:
Kyle Roux
2017-05-16 10:51:21 -07:00
parent ce763d6493
commit 8faabf9775
6 changed files with 79 additions and 87 deletions

View File

@ -0,0 +1,15 @@
{% macro render_field(field, kwargs) %}
{% if field.label.text != 'CSRF Token' and field.type != 'SubmitField' %}
<div class="form-group{%if field.errors %} has-error{% endif %}">
{% if field.label.text %}
{% if field.flags.required %}<span style="color:red; font-size:22px;">*</span>{% endif %} {{ field.label }}
{% endif %}
{{ field(**kwargs) }}
{% for error in field.errors %}
<span class="help-block">{{ error }}</span>
{% endfor %}
</div>
{% elif field.type == 'SubmitField' %}
{{ field(**kwargs) }}
{% endif %}
{% endmacro %}