diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2009-02-08 11:14:07 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2009-02-08 11:14:07 +0000 |
| commit | d4a3a4b0ca7888ed98e03348af062b0d31d779aa (patch) | |
| tree | 4cee63a51210ec8c0deedb787dc3bbd4f1eb0d78 /django/db/models/query.py | |
| parent | addd3df3bd39730cd82c52d9726c9b7dbf1bdb8f (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 'django/db/models/query.py')
| -rw-r--r-- | django/db/models/query.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/django/db/models/query.py b/django/db/models/query.py index e33a858a81..c06a37897e 100644 --- a/django/db/models/query.py +++ b/django/db/models/query.py @@ -307,11 +307,13 @@ class QuerySet(object): for arg in args: kwargs[arg.default_alias] = arg + query = self.query.clone() + for (alias, aggregate_expr) in kwargs.items(): - self.query.add_aggregate(aggregate_expr, self.model, alias, + query.add_aggregate(aggregate_expr, self.model, alias, is_summary=True) - return self.query.get_aggregation() + return query.get_aggregation() def count(self): """ |
