summaryrefslogtreecommitdiff
path: root/django/db/models/base.py
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2016-03-28 18:33:29 -0400
committerTim Graham <timograham@gmail.com>2016-04-08 09:51:06 -0400
commitdf8d8d4292684d6ffa7474f1e201aed486f02b53 (patch)
treec661bf9b33de5288afe4f63347a2a9c768ef98eb /django/db/models/base.py
parent2956e2f5e3f63d279f5dae2a995265364d3e6db1 (diff)
Fixed E128 flake8 warnings in django/.
Diffstat (limited to 'django/db/models/base.py')
-rw-r--r--django/db/models/base.py20
1 files changed, 8 insertions, 12 deletions
diff --git a/django/db/models/base.py b/django/db/models/base.py
index 7b0b68f983..c029fd812a 100644
--- a/django/db/models/base.py
+++ b/django/db/models/base.py
@@ -519,9 +519,10 @@ class Model(six.with_metaclass(ModelBase)):
if pickled_version:
current_version = get_version()
if current_version != pickled_version:
- msg = ("Pickled model instance's Django version %s does"
- " not match the current version %s."
- % (pickled_version, current_version))
+ msg = (
+ "Pickled model instance's Django version %s does not match "
+ "the current version %s." % (pickled_version, current_version)
+ )
else:
msg = "Pickled model instance's Django version is not specified."
@@ -1285,9 +1286,7 @@ class Model(six.with_metaclass(ModelBase)):
@classmethod
def _check_id_field(cls):
""" Check if `id` field is a primary key. """
-
- fields = list(f for f in cls._meta.local_fields
- if f.name == 'id' and f != cls._meta.pk)
+ fields = list(f for f in cls._meta.local_fields if f.name == 'id' and f != cls._meta.pk)
# fields is empty or consists of the invalid "id" field
if fields and not fields[0].primary_key and cls._meta.pk.name == 'id':
return [
@@ -1342,8 +1341,7 @@ class Model(six.with_metaclass(ModelBase)):
# field "id" and automatically added unique field "id", both
# defined at the same model. This special case is considered in
# _check_id_field and here we ignore it.
- id_conflict = (f.name == "id" and
- clash and clash.name == "id" and clash.model == cls)
+ id_conflict = f.name == "id" and clash and clash.name == "id" and clash.model == cls
if clash and not id_conflict:
errors.append(
checks.Error(
@@ -1397,8 +1395,7 @@ class Model(six.with_metaclass(ModelBase)):
)
]
- elif any(not isinstance(fields, (tuple, list))
- for fields in cls._meta.index_together):
+ elif any(not isinstance(fields, (tuple, list)) for fields in cls._meta.index_together):
return [
checks.Error(
"All 'index_together' elements must be lists or tuples.",
@@ -1425,8 +1422,7 @@ class Model(six.with_metaclass(ModelBase)):
)
]
- elif any(not isinstance(fields, (tuple, list))
- for fields in cls._meta.unique_together):
+ elif any(not isinstance(fields, (tuple, list)) for fields in cls._meta.unique_together):
return [
checks.Error(
"All 'unique_together' elements must be lists or tuples.",