{% load form_helpers %}

<div class="form-group{% if field.errors %} has-error{% endif %}">
    {% if field|widget_type == 'checkboxinput' %}
        <div class="col-md-9 col-md-offset-3">
            <div class="checkbox{% if field.errors %} has-error{% endif %}">
                <label for="{{ field.id_for_label }}">
                    {{ field }}
                    {{ field.label }}
                </label>
                {% if field.help_text %}
                    <span class="help-block">{{ field.help_text|safe }}</span>
                {% endif %}
            </div>
        </div>
    {% elif field|widget_type == 'radioselect' %}
        <div class="col-md-9 col-md-offset-3">
            <div class="radio{% if field.errors %} has-error{% endif %}">
                <label for="{{ field.id_for_label }}">
                    {{ field }}
                    {{ field.label }}
                </label>
            </div>
        </div>
    {% elif field|widget_type == 'textarea' %}
        <div class="col-md-12">
            {{ field }}
            {% if field.help_text %}
                <span class="help-block">{{ field.help_text|safe }}</span>
            {% endif %}
            {% if field.errors %}
                <ul>
                    {% for error in field.errors %}
                        <li class="text-danger">{{ error }}</li>
                    {% endfor %}
                </ul>
            {% endif %}
        </div>
    {% else %}
        <label class="col-md-3 control-label{% if field.field.required %} required{% endif %}" for="{{ field.id_for_label }}">{{ field.label }}</label>
        <div class="col-md-9">
            {{ field }}
            {% if field.help_text %}
                <span class="help-block">{{ field.help_text|safe }}</span>
            {% endif %}
            {% if field.errors %}
                <ul>
                    {% for error in field.errors %}
                        <li class="text-danger">{{ error }}</li>
                    {% endfor %}
                </ul>
            {% endif %}
        </div>
    {% endif %}
</div>
