{% load form_tags %} {% comment %} Make the field widget type available to templates so we can mark-up checkboxes differently to other widgets. {% endcomment %} {% annotate_form_field field %}
{% if field.is_hidden %} {{ field }} {% else %} {# Check if field is a checkbox as we mark these up differently #} {% if field.widget_type == 'CheckboxInput' %}
{% for error in field.errors %} {{ error }} {% endfor %} {% if field.help_text %} {# We allow HTML within form help fields #} {{ field.help_text|safe }} {% endif %}
{% else %}
{{ field }} {% for error in field.errors %} {{ error }} {% endfor %} {% if field.help_text %} {# We allow HTML within form help fields #} {{ field.help_text|safe }} {% endif %}
{% endif %} {% endif %}