summaryrefslogtreecommitdiff
path: root/tests/modeltests/aggregation
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2009-02-23 14:47:59 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2009-02-23 14:47:59 +0000
commit542709d0d1796326dd1edacf32fc1198cfad2869 (patch)
tree40578c8972862606d7ddb0dad9c7e0e163b160e0 /tests/modeltests/aggregation
parent4bd24474c02a6f3c70e8111ac262fabf2fc5f454 (diff)
downloaddjango-542709d0d1796326dd1edacf32fc1198cfad2869.tar.gz
Fixed #10182 -- Corrected realiasing and the process of evaluating values() for queries with aggregate clauses. This means that aggregate queries can now be used as subqueries (such as in an __in clause). Thanks to omat for the report.
This involves a slight change to the interaction of annotate() and values() clauses that specify a list of columns. See the docs for details. git-svn-id: http://code.djangoproject.com/svn/django/trunk@9888 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/modeltests/aggregation')
-rw-r--r--tests/modeltests/aggregation/models.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/tests/modeltests/aggregation/models.py b/tests/modeltests/aggregation/models.py
index 8537d0bd66..04b05f90f9 100644
--- a/tests/modeltests/aggregation/models.py
+++ b/tests/modeltests/aggregation/models.py
@@ -207,10 +207,9 @@ u'The Definitive Guide to Django: Web Development Done Right'
>>> Book.objects.filter(pk=1).annotate(mean_age=Avg('authors__age')).values('pk', 'isbn', 'mean_age')
[{'pk': 1, 'isbn': u'159059725', 'mean_age': 34.5}]
-# Calling it with paramters reduces the output but does not remove the
-# annotation.
+# Calling values() with parameters reduces the output
>>> Book.objects.filter(pk=1).annotate(mean_age=Avg('authors__age')).values('name')
-[{'name': u'The Definitive Guide to Django: Web Development Done Right', 'mean_age': 34.5}]
+[{'name': u'The Definitive Guide to Django: Web Development Done Right'}]
# An empty values() call before annotating has the same effect as an
# empty values() call after annotating