summaryrefslogtreecommitdiff
path: root/django/db/models/sql/compiler.py
diff options
context:
space:
mode:
authorAnssi Kääriäinen <anssi.kaariainen@thl.fi>2014-12-18 11:02:43 +0200
committerCarl Meyer <carl@oddbird.net>2014-12-18 06:01:07 -0700
commit4a2a433e7daca1e1797b7b34d30d49ad4e09791c (patch)
treec693ea4b22777b01e5c395d031e55cd29974a59f /django/db/models/sql/compiler.py
parent9c1f501d7b392db84fe1b0f0e74947e806d7eefb (diff)
Refs #24020 -- return expressions from get_group_by_cols()
Diffstat (limited to 'django/db/models/sql/compiler.py')
-rw-r--r--django/db/models/sql/compiler.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py
index b0e3e48c15..c70dd8c5bd 100644
--- a/django/db/models/sql/compiler.py
+++ b/django/db/models/sql/compiler.py
@@ -583,10 +583,11 @@ class SQLCompiler(object):
for annotation in self.query.annotation_select.values():
cols = annotation.get_group_by_cols()
for col in cols:
- sql = '%s.%s' % (qn(col[0]), qn(col[1]))
- if sql not in seen:
+ sql, col_params = self.compile(col)
+ if sql not in seen or col_params:
result.append(sql)
seen.add(sql)
+ params.extend(col_params)
return result, params