summaryrefslogtreecommitdiff
path: root/tests/regressiontests/aggregation_regress
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2009-02-08 11:14:07 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2009-02-08 11:14:07 +0000
commitd4a3a4b0ca7888ed98e03348af062b0d31d779aa (patch)
tree4cee63a51210ec8c0deedb787dc3bbd4f1eb0d78 /tests/regressiontests/aggregation_regress
parentaddd3df3bd39730cd82c52d9726c9b7dbf1bdb8f (diff)
Fixed #10199 -- Modified aggregate() calls to clone the base query so that the base query can be reused. Thanks to Alex Gaynor for the report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9819 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/aggregation_regress')
-rw-r--r--tests/regressiontests/aggregation_regress/models.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/regressiontests/aggregation_regress/models.py b/tests/regressiontests/aggregation_regress/models.py
index 24de920290..fc2c44b09e 100644
--- a/tests/regressiontests/aggregation_regress/models.py
+++ b/tests/regressiontests/aggregation_regress/models.py
@@ -200,6 +200,12 @@ FieldError: Cannot resolve keyword 'foo' into field. Choices are: authors, conta
>>> sorted([(b.name, b.authors__age__avg, b.publisher.name, b.contact.name) for b in books])
[(u'Artificial Intelligence: A Modern Approach', 51.5, u'Prentice Hall', u'Peter Norvig'), (u'Practical Django Projects', 29.0, u'Apress', u'James Bennett'), (u'Python Web Development with Django', 30.3..., u'Prentice Hall', u'Jeffrey Forcier'), (u'Sams Teach Yourself Django in 24 Hours', 45.0, u'Sams', u'Brad Dayley')]
+# Regression for #10199 - Aggregate calls clone the original query so the original query can still be used
+>>> books = Book.objects.all()
+>>> _ = books.aggregate(Avg('authors__age'))
+>>> books.all()
+[<Book: Artificial Intelligence: A Modern Approach>, <Book: Paradigms of Artificial Intelligence Programming: Case Studies in Common Lisp>, <Book: Practical Django Projects>, <Book: Python Web Development with Django>, <Book: Sams Teach Yourself Django in 24 Hours>, <Book: The Definitive Guide to Django: Web Development Done Right>]
+
"""
}