Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

OrderedDict creation avoidance for .values() queries

Avoid accessing query.extra and query.aggregates directly for .values()
queries. Refs #20950.
  • Loading branch information...
commit d64060a73650360dcabfdb4928a9e92d090925b1 1 parent 4372718
@akaariai akaariai authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 django/db/models/
4 django/db/models/
@@ -1082,7 +1082,7 @@ def _setup_query(self):
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 @@ def _setup_query(self):
# 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:
elif f in self.query.aggregate_select:
Please sign in to comment.
Something went wrong with that request. Please try again.