diff options
| author | Willem Van Onsem <vanonsem.willem@gmail.com> | 2024-04-21 20:06:12 +0200 |
|---|---|---|
| committer | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> | 2024-05-22 10:31:24 +0200 |
| commit | 2995aeab56d661663e2851b29bba1fc20c2541f0 (patch) | |
| tree | c7f848187fca162008d0e62fc5a21ff8a834352b /tests/admin_inlines/tests.py | |
| parent | c7fc9f20b49b5889a9a8f47de45165ac443c1a21 (diff) | |
Fixed #35393 -- Added excluded pk as a hidden field to the inline admin.
Diffstat (limited to 'tests/admin_inlines/tests.py')
| -rw-r--r-- | tests/admin_inlines/tests.py | 15 |
1 files changed, 15 insertions, 0 deletions
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, "<label>Inner readonly label:</label>") + 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'<input type="hidden" name="uuidchild_set-0-id" value="{child.id}" ' + 'id="id_uuidchild_set-0-id">', + 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")) |
