diff options
| author | Anssi Kääriäinen <akaariai@gmail.com> | 2013-10-01 10:56:13 +0300 |
|---|---|---|
| committer | Anssi Kääriäinen <akaariai@gmail.com> | 2013-10-01 10:56:13 +0300 |
| commit | d64060a73650360dcabfdb4928a9e92d090925b1 (patch) | |
| tree | 9f6fe1c4e9b123fee4ce27b8976341a589542ee7 | |
| parent | 4372718e839d15c707d50cc78274a355258cf36a (diff) | |
OrderedDict creation avoidance for .values() queries
Avoid accessing query.extra and query.aggregates directly for .values()
queries. Refs #20950.
| -rw-r--r-- | django/db/models/query.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/django/db/models/query.py b/django/db/models/query.py index baf436791a..f4f61614d2 100644 --- a/django/db/models/query.py +++ b/django/db/models/query.py @@ -1082,7 +1082,7 @@ class ValuesQuerySet(QuerySet): if self._fields: self.extra_names = [] self.aggregate_names = [] - if not self.query.extra and not self.query.aggregates: + if not self.query._extra and not self.query._aggregates: # Short cut - if there are no extra or aggregates, then # the values() clause must be just field names. self.field_names = list(self._fields) @@ -1093,7 +1093,7 @@ class ValuesQuerySet(QuerySet): # we inspect the full extra_select list since we might # be adding back an extra select item that we hadn't # had selected previously. - if f in self.query.extra: + if self.query._extra and f in self.query._extra: self.extra_names.append(f) elif f in self.query.aggregate_select: self.aggregate_names.append(f) |
