summaryrefslogtreecommitdiff
path: root/tests/regressiontests/aggregation_regress
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2009-04-11 12:09:34 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2009-04-11 12:09:34 +0000
commit0fff47c90f01c33ffdd0e8ed8c4a623693b7d4dd (patch)
tree25eb27207192f251f1a2657a4a30ae1f4ec34526 /tests/regressiontests/aggregation_regress
parentb1a5db37e6631ab4a964d7f8d52dfe593f9e6c4b (diff)
Fixed #10766 -- Raise an error when annotate() references another aggreagte(). Thanks to aseering@mit.edu for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10521 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/aggregation_regress')
-rw-r--r--tests/regressiontests/aggregation_regress/models.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/regressiontests/aggregation_regress/models.py b/tests/regressiontests/aggregation_regress/models.py
index 3ce0f6e75d..a6f99a997d 100644
--- a/tests/regressiontests/aggregation_regress/models.py
+++ b/tests/regressiontests/aggregation_regress/models.py
@@ -297,6 +297,11 @@ FieldError: Cannot resolve keyword 'foo' into field. Choices are: authors, conta
>>> HardbackBook.objects.annotate(n_authors=Count('authors')).values('name','n_authors')
[{'n_authors': 2, 'name': u'Artificial Intelligence: A Modern Approach'}, {'n_authors': 1, 'name': u'Paradigms of Artificial Intelligence Programming: Case Studies in Common Lisp'}]
+# Regression for #10766 - Shouldn't be able to reference an aggregate fields in an an aggregate() call.
+>>> Book.objects.all().annotate(mean_age=Avg('authors__age')).annotate(Avg('mean_age'))
+Traceback (most recent call last):
+...
+FieldError: Cannot compute Avg('mean_age'): 'mean_age' is an aggregate
"""
}