{% extends "admin/change_form.html" %} {% comment %} Renders the fieldsets and the inlines in one loop, in the order of `fieldsets_with_inlines`. To customize, extend this template and set it as the ModelAdmin's `change_form_template`. {% endcomment %} {% block field_sets %} {% if fieldsets_with_inlines %} {% for item in fieldsets_with_inlines %} {% if item.is_inline %} {% with inline_admin_formset=item.inline_admin_formset %} {% block layout_inline %} {% include inline_admin_formset.opts.template %} {% endblock layout_inline %} {% endwith %} {% else %} {% with fieldset=item.fieldset %} {% block layout_fieldset %} {% include "admin/fieldsets_extra/includes/fieldset.html" %} {% endblock layout_fieldset %} {% endwith %} {% endif %} {% endfor %} {% else %} {{ block.super }} {% endif %} {% endblock field_sets %} {% block inline_field_sets %} {% if not fieldsets_with_inlines %} {{ block.super }} {% endif %} {% endblock inline_field_sets %}