diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2009-03-14 04:32:52 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2009-03-14 04:32:52 +0000 |
| commit | 84ce18fc9bbb8a7debd8904f746ae8c57844d291 (patch) | |
| tree | 989b0bfbcdc518fe47006f95e3309f988512746a /django/db/models/sql | |
| parent | 83c1572cc47283b97c78a4b695788bcb755ca358 (diff) | |
Fixed #10425 -- Corrected the interaction of .count() with .annotate() when .values() is also involved. Thanks to kmassey for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10053 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/models/sql')
| -rw-r--r-- | django/db/models/sql/query.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py index da34694fed..775dfae772 100644 --- a/django/db/models/sql/query.py +++ b/django/db/models/sql/query.py @@ -329,7 +329,7 @@ class BaseQuery(object): Performs a COUNT() query using the current filter constraints. """ obj = self.clone() - if len(self.select) > 1: + if len(self.select) > 1 or self.aggregate_select: # If a select clause exists, then the query has already started to # specify the columns that are to be returned. # In this case, we need to use a subquery to evaluate the count. @@ -1950,6 +1950,7 @@ class BaseQuery(object): # Clear out the select cache to reflect the new unmasked aggregates. self.aggregates = {None: count} self.set_aggregate_mask(None) + self.group_by = None def add_select_related(self, fields): """ |
