Code

Ticket #14657: extra_select.diff

File extra_select.diff, 735 bytes (added by Gregory, 4 years ago)
Line 
1Index: django/db/models/sql/compiler.py
2===================================================================
3--- django/db/models/sql/compiler.py    (revision 14509)
4+++ django/db/models/sql/compiler.py    (working copy)
5@@ -479,7 +479,7 @@
6             for extra_select, extra_params in self.query.extra_select.itervalues():
7                 extra_selects.append(extra_select)
8                 params.extend(extra_params)
9-            for col in group_by + self.query.related_select_cols + extra_selects:
10+            for col in group_by + self.query.related_select_cols:
11                 if isinstance(col, (list, tuple)):
12                     result.append('%s.%s' % (qn(col[0]), qn(col[1])))
13                 elif hasattr(col, 'as_sql'):