{% load aldryn_forms_tags i18n %}

{% if field %}
    <div class="form-group{% if field.field.required %} form-required{% endif %}{% if field.errors %} has-error{% endif %}">
        {% block form_field_label %}
            <label for="{{ field.auto_id }}">
                {{ field.label }}
                {% if field.field.required %}
                    <abbr title="{% trans "Required field" %}">*</abbr>
                {% endif %}
            </label>
        {% endblock form_field_label %}
        {% block form_field %}
            <select  class="form-control" name="{{ field.name }}" id="{{ field.auto_id }}">
                {% for choice in field.field.choices %}
                    <option value="{{ choice.0 }}"{% if choice.0|force_text == field.value|force_text %} selected="selected"{% endif %}>{{ choice.1 }}</option>
                {% endfor %}
            </select>
        {% endblock form_field %}
        {% block form_field_errors %}
            {% if field.errors %}
                {% for error in field.errors %}
                    <span class="text-danger">{{ error }}</span>
                {% endfor %}
            {% endif %}
        {% endblock form_field_errors %}
        {% block form_field_help_text %}
            {% if field.help_text %}
                <p class="help-block">{{ field.help_text }}</p>
            {% endif %}
        {% endblock form_field_help_text %}
    </div>
{% endif %}
