mirror of
https://github.com/django/django.git
synced 2025-09-24 19:23:03 +00:00
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
This commit is contained in:
parent
addd3df3bd
commit
d4a3a4b0ca
2 changed files with 10 additions and 2 deletions
|
@ -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):
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue