diff options
| author | Sergey Fedoseev <fedoseev.sergey@gmail.com> | 2017-08-31 16:11:30 +0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-08-31 07:11:30 -0400 |
| commit | ab3e3658cc67debaf90b747fd24ecd1d49b31bf3 (patch) | |
| tree | bad525bd9dbc003a0e30e629af1ad1b7d73c415d | |
| parent | 20a761697fd28c08ab82dec777b4056a5bfaf6a2 (diff) | |
Simplified model's Options._get_fields() a bit.
| -rw-r--r-- | django/db/models/options.py | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/django/db/models/options.py b/django/db/models/options.py index 3a4a33e7f9..c81a61c916 100644 --- a/django/db/models/options.py +++ b/django/db/models/options.py @@ -4,7 +4,6 @@ import warnings from bisect import bisect from collections import OrderedDict, defaultdict from contextlib import suppress -from itertools import chain from django.apps import apps from django.conf import settings @@ -786,18 +785,15 @@ class Options: fields.append(field.remote_field) if forward: - fields.extend( - field for field in chain(self.local_fields, self.local_many_to_many) - ) + fields += self.local_fields + fields += self.local_many_to_many # Private fields are recopied to each child model, and they get a # different model as field.model in each child. Hence we have to # add the private fields separately from the topmost call. If we # did this recursively similar to local_fields, we would get field # instances with field.model != self.model. if topmost_call: - fields.extend( - f for f in self.private_fields - ) + fields += self.private_fields # In order to avoid list manipulation. Always # return a shallow copy of the results |
