{% load crispy_forms_field %}

{% if field.is_hidden %}
    {{ field }}
{% else %}
    <{% if tag %}{{ tag }}{% else %}div{% endif %} id="div_{{ field.auto_id }}" class="form-group{% if wrapper_class %} {{ wrapper_class }}{% endif %}{% if form_show_errors%}{% if field.errors %} has-error{% endif %}{% endif %}{% if field.css_classes %} {{ field.css_classes }}{% endif %}">
        {% if field.label and not field|is_checkbox and form_show_labels %}
            <label for="{{ field.id_for_label }}" class="control-label {{ label_class }}{% if field.field.required %} requiredField{% endif %}">
                {{ field.label|safe }}{% if field.field.required %}<span class="asteriskField">*</span>{% endif %}
            </label>
        {% endif %}

        <div class="controls {{ field_class }}">
            {% if field|is_checkbox %}
                <label for="{{ field.id_for_label }}" class="checkbox {% if field.field.required %} requiredField{% endif %}">
                    {% crispy_field field %}
                    {{ field.label|safe }}
                    {% include 'bootstrap3/layout/help_text_and_errors.html' %}
                </label>
            {% else %}
                {% crispy_field field %}
                {% include 'bootstrap3/layout/help_text_and_errors.html' %}
            {% endif %}
        </div>
    </{% if tag %}{{ tag }}{% else %}div{% endif %}>
{% endif %}
