From 2995aeab56d661663e2851b29bba1fc20c2541f0 Mon Sep 17 00:00:00 2001 From: Willem Van Onsem Date: Sun, 21 Apr 2024 20:06:12 +0200 Subject: Fixed #35393 -- Added excluded pk as a hidden field to the inline admin. --- tests/admin_inlines/tests.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tests/admin_inlines/tests.py') diff --git a/tests/admin_inlines/tests.py b/tests/admin_inlines/tests.py index dee703825d..25512aede4 100644 --- a/tests/admin_inlines/tests.py +++ b/tests/admin_inlines/tests.py @@ -44,6 +44,8 @@ from .models import ( SomeChildModel, SomeParentModel, Teacher, + UUIDChild, + UUIDParent, VerboseNamePluralProfile, VerboseNameProfile, ) @@ -115,6 +117,19 @@ class TestInline(TestDataMixin, TestCase): ) self.assertContains(response, "") + def test_excluded_id_for_inlines_uses_hidden_field(self): + parent = UUIDParent.objects.create() + child = UUIDChild.objects.create(title="foo", parent=parent) + response = self.client.get( + reverse("admin:admin_inlines_uuidparent_change", args=(parent.id,)) + ) + self.assertContains( + response, + f'', + html=True, + ) + def test_many_to_many_inlines(self): "Autogenerated many-to-many inlines are displayed correctly (#13407)" response = self.client.get(reverse("admin:admin_inlines_author_add")) -- cgit v1.3