summaryrefslogtreecommitdiff
path: root/django/contrib/admin/helpers.py
diff options
context:
space:
mode:
Diffstat (limited to 'django/contrib/admin/helpers.py')
-rw-r--r--django/contrib/admin/helpers.py5
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