{% load twitter_bootstrap %}

{% if field|is_radio %}
{% for radio in field %}
<div class="radio">
    <label>
        {{ radio.tag }} {{ radio.choice_label }}
    </label>
</div>
{% endfor %}
{% else %}
<div class="{% if field|is_checkbox %}checkbox{% else %}form-group{% endif %}">
    {% if field|is_checkbox %}
        <label for="{{ field.auto_id }}">
            {{ field }} {{ field.label }}{% if field.field.required %}{{ required_suffix }}{% endif %}
        </label>
    {% else %}
        <label for="{{ field.auto_id }}">{{ field.label }}{% if field.field.required %}{{ required_suffix }}{% endif %}</label>
        {% if not field|is_file %}
        {{ field|add_class:"form-control" }}
        {% else %}
        {{ field }}
        {% endif %}
    {% endif %}

    {% for error in field.errors %}
        <span class="help-inline text-danger">{{ error }}</span>
    {% endfor %}

    {% if field.help_text %}
        <p class="help-block">{{ field.help_text|safe }}</p>
    {% endif %}
</div>
{% endif %}
