mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Refs #30557 -- Fixed crash of ordering by ptr fields when Meta.ordering contains F() expressions.
Thanks Can Sarıgöl for the report.
Follow up to 8c5f9906c5.
This commit is contained in:
@@ -722,6 +722,8 @@ class SQLCompiler:
|
||||
|
||||
results = []
|
||||
for item in opts.ordering:
|
||||
if hasattr(item, 'resolve_expression') and not isinstance(item, OrderBy):
|
||||
item = item.desc() if descending else item.asc()
|
||||
if isinstance(item, OrderBy):
|
||||
results.append((item, False))
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user