summaryrefslogtreecommitdiff
path: root/django/db/models/sql/query.py
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 /django/db/models/sql/query.py
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 'django/db/models/sql/query.py')
-rw-r--r--django/db/models/sql/query.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
index 256cbef8e1..403968e118 100644
--- a/django/db/models/sql/query.py
+++ b/django/db/models/sql/query.py
@@ -1403,6 +1403,9 @@ class BaseQuery(object):
field_name = field_list[0]
col = field_name
source = self.aggregates[field_name]
+ if not is_summary:
+ raise FieldError("Cannot compute %s('%s'): '%s' is an aggregate" % (
+ aggregate.name, field_name, field_name))
elif ((len(field_list) > 1) or
(field_list[0] not in [i.name for i in opts.fields]) or
self.group_by is None or