1
0
mirror of https://github.com/django/django.git synced 2025-10-26 07:06:08 +00:00

Fixed #35393 -- Added excluded pk as a hidden field to the inline admin.

This commit is contained in:
Willem Van Onsem
2024-04-21 20:06:12 +02:00
committed by Sarah Boyce
parent c7fc9f20b4
commit 2995aeab56
4 changed files with 44 additions and 0 deletions

View File

@@ -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"))