summaryrefslogtreecommitdiff
path: root/django/forms/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'django/forms/models.py')
-rw-r--r--django/forms/models.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/django/forms/models.py b/django/forms/models.py
index 651749a356..0fba08855f 100644
--- a/django/forms/models.py
+++ b/django/forms/models.py
@@ -788,8 +788,12 @@ class BaseModelFormSet(BaseFormSet):
# True, so check for that as well.
def pk_is_not_editable(pk):
- return ((not pk.editable) or (pk.auto_created or isinstance(pk, AutoField))
- or (pk.remote_field and pk.remote_field.parent_link and pk_is_not_editable(pk.remote_field.model._meta.pk)))
+ return (
+ (not pk.editable) or (pk.auto_created or isinstance(pk, AutoField)) or (
+ pk.remote_field and pk.remote_field.parent_link
+ and pk_is_not_editable(pk.remote_field.model._meta.pk)
+ )
+ )
if pk_is_not_editable(pk) or pk.name not in form.fields:
if form.is_bound:
# If we're adding the related instance, ignore its primary key