{% if form.non_field_errors() %}
    <div class="alert alert-danger">
        <a class="close" data-dismiss="alert">&times;</a>
        {% for non_field_error in form.non_field_errors() %}
             {{ non_field_error }}
        {% endfor %}
    </div>
{% endif %}

{% for field in form.hidden_fields() %}
    {{ field }}
{% endfor %}

{% for field in form.visible_fields() %}
  {% include 'bootstrapform/field.jinja' %}
{% endfor %}
{% if form.non_field_errors() %}
    <div class="alert alert-danger">
        <a class="close" data-dismiss="alert">&times;</a>
        {% for non_field_error in form.non_field_errors() %}
             {{ non_field_error }}
        {% endfor %}
    </div>
{% endif %}

{% for field in form.hidden_fields() %}
    {{ field|safe }}
{% endfor %}

{% for field in form.visible_fields() %}
  {% include 'bootstrapform/field.jinja' %}
{% endfor %}

Mark hidden fields as safe so they display correctly
Mark hidden fields as safe so they display correctly