diff --git a/django/contrib/admin/templates/admin/edit_inline/stacked.html b/django/contrib/admin/templates/admin/edit_inline/stacked.html index 0fa81ef597..79c052c6c5 100644 --- a/django/contrib/admin/templates/admin/edit_inline/stacked.html +++ b/django/contrib/admin/templates/admin/edit_inline/stacked.html @@ -4,7 +4,7 @@ {{ inline_admin_formset.formset.management_form }} {{ inline_admin_formset.formset.non_form_errors }} -{% for inline_admin_form in inline_admin_formset %}
+{% for inline_admin_form in inline_admin_formset %}

{{ inline_admin_formset.opts.verbose_name|capfirst }}: {% if inline_admin_form.original %}{{ inline_admin_form.original }}{% else %}#{{ forloop.counter }}{% endif %} {% if inline_admin_form.show_url %}{% trans "View on site" %}{% endif %} {% if inline_admin_formset.formset.can_delete and inline_admin_form.original %}{{ inline_admin_form.deletion_field.field }} {{ inline_admin_form.deletion_field.label_tag }}{% endif %} diff --git a/tests/admin_inlines/tests.py b/tests/admin_inlines/tests.py index e840e21b81..4ef584f3de 100644 --- a/tests/admin_inlines/tests.py +++ b/tests/admin_inlines/tests.py @@ -239,6 +239,21 @@ class TestInline(TestCase): '', html=True, count=1) + def test_stacked_inline_edit_form_contains_has_original_class(self): + holder = Holder.objects.create(dummy=1) + holder.inner_set.create(dummy=1) + response = self.client.get('/admin/admin_inlines/holder/%s/' % holder.pk) + self.assertContains( + response, + '