summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorJustin Bronn <jbronn@gmail.com>2010-02-23 05:26:49 +0000
committerJustin Bronn <jbronn@gmail.com>2010-02-23 05:26:49 +0000
commit5546430304f1310e76b217bb3b6e3597d9b87359 (patch)
tree6383d4ff52fdf7dbec1bcf8b359462ae1412ea3b /django
parentc4699b0b8a8503e552de1fe4f873685f7037b337 (diff)
Fixed #12608 -- No longer return inconsistent results when using `values` and `values_list` in conjunction with `annotate`. Thanks, Charlie Leifer.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12505 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
-rw-r--r--django/db/models/query.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/django/db/models/query.py b/django/db/models/query.py
index 0424569e0b..7492039b2c 100644
--- a/django/db/models/query.py
+++ b/django/db/models/query.py
@@ -954,7 +954,8 @@ class ValuesListQuerySet(ValuesQuerySet):
# If a field list has been specified, use it. Otherwise, use the
# full list of fields, including extras and aggregates.
if self._fields:
- fields = self._fields
+ fields = list(self._fields) + filter(lambda f: f not in self._fields,
+ aggregate_names)
else:
fields = names