{% load addcss %} {% load form_utils %} {% if child.errors %}

Please correct the error{{ child.errors|pluralize }} below.

{% endif %} {% if child.non_field_errors %} {% for error in child.non_field_errors %}

{{ error }}

{% endfor %} {% endif %}
{% csrf_token %} {% if child.fieldsets %} {% for fieldset in child.fieldsets %}
{% if fieldset.legend %} {{ fieldset.legend }} {% endif %} {% if fieldset.description %}

{{ fieldset.description }}

{% endif %} {% for field in fieldset %} {% if field.is_hidden %} {{ field }} {% else %}
{{field|addcss:"form-control"}} {% if field.errors|length > 0 %}
{% for error in field.errors %} {{ error }} {% endfor %}
{% endif %}
{% endif %} {% endfor %}
{% endfor %} {# For the rest of the fields, render them as they are not registered on any other fieldset #} {% for field in child %} {% for fieldset in child.fieldsets.fieldsets %} {% if field.html_name not in fieldset.1.fields %}
{{field|addcss:"form-control"}} {% if field.errors|length > 0 %}
{% for error in field.errors %} {{ error }} {% endfor %}
{% endif %}
{% endif %} {% endfor %} {% endfor %} {% else %} {% for field in child %}
{{field|addcss:"form-control"}} {% if field.errors|length > 0 %}
{% for error in field.errors %} {{ error }} {% endfor %}
{% endif %}
{% endfor %} {% endif %}