{% extends "admin/change_form.html" %}
{% load i18n %}

{% block after_field_sets %}
{% if adminform.form.is_custom_form %}
<fieldset class="module aligned{% if adminform.form.custom_classes %} {{ adminform.form.custom_classes }}{% endif %}">
    {% if adminform.form.custom_name %}<h2>{{ adminform.form.custom_name }}</h2>{% endif %}
    {% if adminform.form.custom_description %}
        <div class="description">{{ adminform.form.custom_description|safe }}</div>
    {% endif %}
    {% for field in adminform.form %}
        {% if field.field.is_custom %}
        <div class="control-group form-row">
            <div class="field-box{% if field.name %} field-{{ field.name }}{% endif %}">
                {% if not field.field.is_readonly %}{{ field.errors }}{% endif %}
                {% if field.is_checkbox %}
                    {{ field }}{{ field.label_tag }}
                {% else %}
                    {{ field.label_tag }}
                    {% if field.is_readonly %}
                        <p>{{ field.contents|linebreaksbr }}</p>
                    {% else %}
                        {{ field }}
                    {% endif %}
                {% endif %}
                {% if field.help_text %}
                    <p class="help">{{ field.help_text|safe }}</p>
                {% endif %}
            </div>
        </div>
        {% endif %}
    {% endfor %}
</fieldset>
{% endif %}
{% endblock %}
