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:
committed by
Sarah Boyce
parent
c7fc9f20b4
commit
2995aeab56
@@ -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"))
|
||||
|
||||
Reference in New Issue
Block a user