Ticket #10290: 10290.diff
File 10290.diff, 1.1 KB (added by , 16 years ago) |
---|
-
django/db/models/sql/query.py
703 703 result = [] 704 704 if self.group_by is not None: 705 705 group_by = self.group_by or [] 706 for col in group_by + self.related_select_cols + self.extra_select.keys(): 706 extra_selects = [v[0] for v in self.extra_select.itervalues()] 707 for col in group_by + self.related_select_cols + extra_selects: 707 708 if isinstance(col, (list, tuple)): 708 709 result.append('%s.%s' % (qn(col[0]), qn(col[1]))) 709 710 elif hasattr(col, 'as_sql'): … … 791 792 if distinct and col not in select_aliases: 792 793 ordering_aliases.append(elt) 793 794 result.append('%s %s' % (elt, order)) 794 group_by.append( elt)795 group_by.append(self.extra_select[col][0]) 795 796 self.ordering_aliases = ordering_aliases 796 797 return result, group_by 797 798