{% macro render_field(field) %}
    {% if field.type in ('HiddenField', 'CSRFTokenField') %}
        {{ field() }}
    {% else %}
        {% if field.errors %}
            <div class="form-group has-error">
                {{ field.label() }}
                {{ field(class='form-control') }}
                {% for error in field.errors %}
                    <span class="help-block">{{ error }}</span>
                {% endfor %}
            </div>
        {% else %}
            <div class="form-group">
                {{ field.label() }}
                {{ field(class='form-control') }}
            </div>
        {% endif %}
    {% endif %}
{% endmacro %}

{% macro render_field(field) %}
    {% if field.type in ('HiddenField', 'CSRFTokenField') %}
        {{ field() }}
    {% else %}
          <div class="form-group{% if field.errors %} has-error{% endif %}">
              {{ field.label() }}
              {{ field(class='form-control') }}
              {% for error in field.errors %}
                  <span class="help-block">{{ error }}</span>
              {% endfor %}
          </div>
    {% endif %}
{% endmacro %}

Remove duplication in render_field macro
Remove duplication in render_field macro
