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 /django/contrib/admin | |
| parent | c7fc9f20b49b5889a9a8f47de45165ac443c1a21 (diff) | |
Fixed #35393 -- Added excluded pk as a hidden field to the inline admin.
Diffstat (limited to 'django/contrib/admin')
| -rw-r--r-- | django/contrib/admin/helpers.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/django/contrib/admin/helpers.py b/django/contrib/admin/helpers.py index a4aa8e40e3..d28a382814 100644 --- a/django/contrib/admin/helpers.py +++ b/django/contrib/admin/helpers.py @@ -509,6 +509,11 @@ class InlineAdminForm(AdminForm): # Auto fields are editable, so check for auto or non-editable pk. self.form._meta.model._meta.auto_field or not self.form._meta.model._meta.pk.editable + # The pk can be editable, but excluded from the inline. + or ( + self.form._meta.exclude + and self.form._meta.model._meta.pk.name in self.form._meta.exclude + ) or # Also search any parents for an auto field. (The pk info is # propagated to child models so that does not need to be checked |
