Fixed #31660 -- Fixed queryset crash when grouping by m2o relation.

Regression in 3a941230c8.

Thanks Tomasz Szymański for the report.
This commit is contained in:
Mariusz Felisiak 2020-06-08 07:21:54 +02:00 committed by GitHub
parent 07506a6114
commit 78ad4b4b02
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 4 deletions

View file

@ -383,7 +383,9 @@ class BaseExpression:
Custom format for select clauses. For example, EXISTS expressions need
to be wrapped in CASE WHEN on Oracle.
"""
return self.output_field.select_format(compiler, sql, params)
if hasattr(self.output_field, 'select_format'):
return self.output_field.select_format(compiler, sql, params)
return sql, params
@cached_property
def identity(self):