Skip to content

Commit 2de55ce

Browse files
Gorahdlo
authored andcommitted
fix ordering in get_grouping method call
1 parent c376a75 commit 2de55ce

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

django_pyodbc/compiler.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434

3535
class SQLCompiler(compiler.SQLCompiler):
36-
36+
3737
def resolve_columns(self, row, fields=()):
3838
index_start = len(self.query.extra_select.keys())
3939
values = [self.query.convert_values(v, None, connection=self.connection) for v in row[:index_start]]
@@ -115,7 +115,7 @@ def _as_sql(self, strategy):
115115
if not ordering:
116116
meta = self.query.get_meta()
117117
qn = self.quote_name_unless_alias
118-
# Special case: pk not in out_cols, use random ordering.
118+
# Special case: pk not in out_cols, use random ordering.
119119
#
120120
if '%s.%s' % (qn(meta.db_table), qn(meta.pk.db_column or meta.pk.column)) not in self.get_columns():
121121
ordering = ['RAND()']
@@ -165,7 +165,7 @@ def _as_sql(self, strategy):
165165
result.append('WHERE %s' % where)
166166
params.extend(w_params)
167167

168-
grouping, gb_params = self.get_grouping()
168+
grouping, gb_params = self.get_grouping(ordering_group_by)
169169
if grouping:
170170
if ordering:
171171
# If the backend can't group by PK (i.e., any database
@@ -241,7 +241,7 @@ def as_sql(self, with_limits=True, with_col_aliases=False):
241241
# SQL Server 2005
242242
if self.connection.ops.sql_server_ver >= 2005:
243243
sql, params = self._as_sql(USE_ROW_NUMBER)
244-
244+
245245
# Construct the final SQL clause, using the initial select SQL
246246
# obtained above.
247247
result = ['SELECT * FROM (%s) AS X' % sql]
@@ -288,7 +288,7 @@ def as_sql(self):
288288
result.append('VALUES (%s)' % ', '.join(values))
289289
params = self.query.params
290290
sql = ' '.join(result)
291-
291+
292292
meta = self.query.get_meta()
293293
if meta.has_auto_field:
294294
# db_column is None if not explicitly specified by model field

0 commit comments

Comments
 (0)