{% load form_tags %} {% load widget_tweaks %} {% if field.is_hidden %} {{ field }} {% else %} {% comment %} Make the field widget type available to templates so we can mark-up checkbox and radio inputs differently to other widgets. {% endcomment %} {% annotate_form_field field %} {% block control_group %}
{% block label %} {% if not nolabel and field.widget_type != 'checkbox' %} {% endif %} {% endblock %} {% block controls %}
{% block widget %} {% if field.widget_type == 'checkbox' %} {% else %} {% render_field field class+="form-control" %} {% endif %} {% endblock %} {% block errors %} {% for error in field.errors %} {{ error }} {% endfor %} {% endblock %} {% block help_text %} {% if field.help_text %} {# We allow HTML within form help fields #} {{ field.help_text|safe }} {% endif %} {% endblock %}
{% endblock %}
{% endblock %} {% endif %}