summaryrefslogtreecommitdiff
path: root/django/forms
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2016-04-03 20:37:32 -0400
committerTim Graham <timograham@gmail.com>2016-04-04 17:14:26 -0400
commit2cd2d188516475ddf256e6267cd82c495fb5c430 (patch)
tree1a7c3c167c1576923c7c4f5544495face5bd7327 /django/forms
parentd356bb653f4d90ae9809e5a051791ded39010c38 (diff)
Fixed W503 flake8 warnings.
Diffstat (limited to 'django/forms')
-rw-r--r--django/forms/models.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/django/forms/models.py b/django/forms/models.py
index 3cafdebd34..b06709ea23 100644
--- a/django/forms/models.py
+++ b/django/forms/models.py
@@ -707,8 +707,8 @@ class BaseModelFormSet(BaseFormSet):
uclass, lookup, field, unique_for = date_check
for form in valid_forms:
# see if we have data for both fields
- if (form.cleaned_data and form.cleaned_data[field] is not None
- and form.cleaned_data[unique_for] is not None):
+ if (form.cleaned_data and form.cleaned_data[field] is not None and
+ form.cleaned_data[unique_for] is not None):
# if it's a date lookup we need to get the data for all the fields
if lookup == 'date':
date = form.cleaned_data[unique_for]
@@ -806,8 +806,8 @@ class BaseModelFormSet(BaseFormSet):
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)
+ 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:
@@ -999,9 +999,10 @@ def _get_foreign_key(parent_model, model, fk_name=None, can_fail=False):
# Try to discover what the ForeignKey from model to parent_model is
fks_to_parent = [
f for f in opts.fields
- if isinstance(f, ForeignKey)
- and (f.remote_field.model == parent_model
- or f.remote_field.model in parent_model._meta.get_parent_list())
+ if isinstance(f, ForeignKey) and (
+ f.remote_field.model == parent_model or
+ f.remote_field.model in parent_model._meta.get_parent_list()
+ )
]
if len(fks_to_parent) == 1:
fk = fks_to_parent[0]