summaryrefslogtreecommitdiff
path: root/django/db/models/sql
diff options
context:
space:
mode:
authorNuno Maltez <nuno@cognitiva.com>2012-07-16 19:52:31 +0300
committerAnssi Kääriäinen <akaariai@gmail.com>2012-07-16 19:52:31 +0300
commitbebbbb7af096ecffc0d7585617fdfacb196bc7c2 (patch)
tree9e256f149ed4ac7df9894b8a637fb4f25b15f8ba /django/db/models/sql
parent35ddeee45573de57ae3c791bf36496b4a7028ddf (diff)
Fixed #18056 - Cleared aggregations on DateQuery.add_date_select
Cleared aggregations on add_date_select method so only distinct dates are returned when dealing with a QuerySet that contained aggregations. That would cause the query set to return repeated dates because it would look for distinct (date kind, aggregation) pairs.
Diffstat (limited to 'django/db/models/sql')
-rw-r--r--django/db/models/sql/subqueries.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/django/db/models/sql/subqueries.py b/django/db/models/sql/subqueries.py
index 5cfc984770..7b92394e90 100644
--- a/django/db/models/sql/subqueries.py
+++ b/django/db/models/sql/subqueries.py
@@ -8,6 +8,7 @@ from django.db.models.sql.constants import *
from django.db.models.sql.datastructures import Date
from django.db.models.sql.query import Query
from django.db.models.sql.where import AND, Constraint
+from django.utils.datastructures import SortedDict
from django.utils.functional import Promise
from django.utils.encoding import force_unicode
@@ -205,6 +206,7 @@ class DateQuery(Query):
self.select = [select]
self.select_fields = [None]
self.select_related = False # See #7097.
+ self.aggregates = SortedDict() # See 18056.
self.set_extra_mask([])
self.distinct = True
self.order_by = order == 'ASC' and [1] or [-1]