diff --git a/django/contrib/admin/templates/admin/change_form.html b/django/contrib/admin/templates/admin/change_form.html index 20cc4a392c..31ff5d6c10 100644 --- a/django/contrib/admin/templates/admin/change_form.html +++ b/django/contrib/admin/templates/admin/change_form.html @@ -47,7 +47,7 @@ {% block field_sets %} {% for fieldset in adminform %} - {% include "admin/includes/fieldset.html" %} + {% include "admin/includes/fieldset.html" with heading_level=2 id_suffix=forloop.counter0 %} {% endfor %} {% endblock %} diff --git a/django/contrib/admin/templates/admin/edit_inline/stacked.html b/django/contrib/admin/templates/admin/edit_inline/stacked.html index 31d917bff0..b0331c65f8 100644 --- a/django/contrib/admin/templates/admin/edit_inline/stacked.html +++ b/django/contrib/admin/templates/admin/edit_inline/stacked.html @@ -3,12 +3,14 @@ id="{{ inline_admin_formset.formset.prefix }}-group" data-inline-type="stacked" data-inline-formset="{{ inline_admin_formset.inline_formset_data }}"> -
+
+

{% if inline_admin_formset.formset.max_num == 1 %} -

{{ inline_admin_formset.opts.verbose_name|capfirst }}

+ {{ inline_admin_formset.opts.verbose_name|capfirst }} {% else %} -

{{ inline_admin_formset.opts.verbose_name_plural|capfirst }}

+ {{ inline_admin_formset.opts.verbose_name_plural|capfirst }} {% endif %} + {{ inline_admin_formset.formset.management_form }} {{ inline_admin_formset.formset.non_form_errors }} @@ -19,9 +21,13 @@ {% if inline_admin_formset.formset.can_delete and inline_admin_formset.has_delete_permission and inline_admin_form.original %}{{ inline_admin_form.deletion_field.field }} {{ inline_admin_form.deletion_field.label_tag }}{% endif %} {% if inline_admin_form.form.non_field_errors %}{{ inline_admin_form.form.non_field_errors }}{% endif %} - {% for fieldset in inline_admin_form %} - {% include "admin/includes/fieldset.html" %} - {% endfor %} + + {% with parent_counter=forloop.counter0 %} + {% for fieldset in inline_admin_form %} + {% include "admin/includes/fieldset.html" with heading_level=4 id_prefix=parent_counter id_suffix=forloop.counter0 %} + {% endfor %} + {% endwith %} + {% if inline_admin_form.needs_explicit_pk_field %}{{ inline_admin_form.pk_field.field }}{% endif %} {% if inline_admin_form.fk_field %}{{ inline_admin_form.fk_field.field }}{% endif %} {% endfor %} diff --git a/django/contrib/admin/templates/admin/edit_inline/tabular.html b/django/contrib/admin/templates/admin/edit_inline/tabular.html index 84c9fe3696..845d3917a4 100644 --- a/django/contrib/admin/templates/admin/edit_inline/tabular.html +++ b/django/contrib/admin/templates/admin/edit_inline/tabular.html @@ -4,12 +4,14 @@ data-inline-formset="{{ inline_admin_formset.inline_formset_data }}">