diff --git a/django/db/models/query.py b/django/db/models/query.py
index e33a858..876968d 100644
a
|
b
|
class QuerySet(object):
|
306 | 306 | """ |
307 | 307 | for arg in args: |
308 | 308 | kwargs[arg.default_alias] = arg |
| 309 | |
| 310 | query = self.query.clone() |
309 | 311 | |
310 | 312 | for (alias, aggregate_expr) in kwargs.items(): |
311 | | self.query.add_aggregate(aggregate_expr, self.model, alias, |
| 313 | query.add_aggregate(aggregate_expr, self.model, alias, |
312 | 314 | is_summary=True) |
313 | 315 | |
314 | | return self.query.get_aggregation() |
| 316 | return query.get_aggregation() |
315 | 317 | |
316 | 318 | def count(self): |
317 | 319 | """ |
diff --git a/tests/regressiontests/aggregation_regress/models.py b/tests/regressiontests/aggregation_regress/models.py
index 24de920..6919b71 100644
a
|
b
|
FieldError: Cannot resolve keyword 'foo' into field. Choices are: authors, conta
|
200 | 200 | >>> sorted([(b.name, b.authors__age__avg, b.publisher.name, b.contact.name) for b in books]) |
201 | 201 | [(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')] |
202 | 202 | |
| 203 | >>> books = Book.objects.all() |
| 204 | >>> _ = books.aggregate(Avg('authors__age')) |
| 205 | >>> books.all() |
| 206 | [<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>] |
| 207 | |
203 | 208 | """ |
204 | 209 | } |
205 | 210 | |