summaryrefslogtreecommitdiff
path: root/django/forms/models.py
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2022-02-04 08:08:27 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-02-07 20:37:05 +0100
commit7119f40c9881666b6f9b5cf7df09ee1d21cc8344 (patch)
treefa50869f5614295f462d9bf77fec59365c621609 /django/forms/models.py
parent9c19aff7c7561e3a82978a272ecdaad40dda5c00 (diff)
Refs #33476 -- Refactored code to strictly match 88 characters line length.
Diffstat (limited to 'django/forms/models.py')
-rw-r--r--django/forms/models.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/django/forms/models.py b/django/forms/models.py
index a55af8eeb6..b6ce73cc5e 100644
--- a/django/forms/models.py
+++ b/django/forms/models.py
@@ -195,8 +195,8 @@ def fields_for_model(
and (exclude is None or f.name not in exclude)
):
raise FieldError(
- "'%s' cannot be specified for %s model form as it is a non-editable field"
- % (f.name, model.__name__)
+ "'%s' cannot be specified for %s model form as it is a "
+ "non-editable field" % (f.name, model.__name__)
)
continue
if fields is not None and f.name not in fields:
@@ -816,7 +816,8 @@ class BaseModelFormSet(BaseFormSet):
for uclass, unique_check in all_unique_checks:
seen_data = set()
for form in valid_forms:
- # Get the data for the set of fields that must be unique among the forms.
+ # Get the data for the set of fields that must be unique among
+ # the forms.
row_data = (
field if field in self.unique_fields else form.cleaned_data[field]
for field in unique_check
@@ -839,7 +840,8 @@ class BaseModelFormSet(BaseFormSet):
[self.get_form_error()],
renderer=self.renderer,
)
- # remove the data from the cleaned_data dict since it was invalid
+ # Remove the data from the cleaned_data dict since it
+ # was invalid.
for field in unique_check:
if field in form.cleaned_data:
del form.cleaned_data[field]
@@ -874,7 +876,8 @@ class BaseModelFormSet(BaseFormSet):
[self.get_form_error()],
renderer=self.renderer,
)
- # remove the data from the cleaned_data dict since it was invalid
+ # Remove the data from the cleaned_data dict since it
+ # was invalid.
del form.cleaned_data[field]
# mark the data as seen
seen_data.add(data)