{% macro render_field(field, addon, prepend, tooltip, label_text) %}
{{ render_label(field, tooltip, label_text) }}
{% set class_ = kwargs.pop('class_', '') %} {% if field.type != 'BooleanField' %} {% set class_ = class_ + ' form-control' %} {% endif %} {% if addon %}
{% if prepend %} {{addon|safe}} {{field(class_=class_, **kwargs)}} {% else %} {{field(class_=class_, **kwargs)}} {{addon|safe}} {% endif %}
{% else %} {{ field(class_=class_, **kwargs) }} {% endif %} {% if field.errors %} {% for error in field.errors %} {{ error }} {% endfor %} {% endif %}
{% endmacro %} {% macro render_label(field, tooltip, text) %} {% if tooltip and text %} {{ field.label(class="control-label", style='width:148px', text=text) }}
 
{% elif tooltip and not text %} {{ field.label(class="control-label", style='width:148px') }}
 
{% elif not tooltip and text %} {{ field.label(class="control-label col-md-2", text=text) }} {% else %} {{ field.label(class="control-label col-md-2") }} {% endif %} {% endmacro %}