mirror of
https://github.com/django/django.git
synced 2025-10-05 00:00:37 +00:00
Fixed #26125 -- Fixed E731 flake warnings.
This commit is contained in:
parent
abc0777b63
commit
60586dd737
36 changed files with 176 additions and 75 deletions
|
@ -371,11 +371,17 @@ class Options(object):
|
|||
# use that property directly because related_model is a cached property,
|
||||
# and all the models may not have been loaded yet; we don't want to cache
|
||||
# the string reference to the related_model.
|
||||
is_not_an_m2m_field = lambda f: not (f.is_relation and f.many_to_many)
|
||||
is_not_a_generic_relation = lambda f: not (f.is_relation and f.one_to_many)
|
||||
is_not_a_generic_foreign_key = lambda f: not (
|
||||
f.is_relation and f.many_to_one and not (hasattr(f.remote_field, 'model') and f.remote_field.model)
|
||||
)
|
||||
def is_not_an_m2m_field(f):
|
||||
return not (f.is_relation and f.many_to_many)
|
||||
|
||||
def is_not_a_generic_relation(f):
|
||||
return not (f.is_relation and f.one_to_many)
|
||||
|
||||
def is_not_a_generic_foreign_key(f):
|
||||
return not (
|
||||
f.is_relation and f.many_to_one and not (hasattr(f.remote_field, 'model') and f.remote_field.model)
|
||||
)
|
||||
|
||||
return make_immutable_fields_list(
|
||||
"fields",
|
||||
(f for f in self._get_fields(reverse=False) if
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue