diff options
| author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2019-07-11 13:40:36 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-07-11 13:40:36 +0200 |
| commit | 7a42cfcfdc94c1e7cd653f3140b9eb30492bae4f (patch) | |
| tree | 6bf03d51b438e982dbf15a7de56afb016baa6b7f /django/db/models/sql | |
| parent | 8c5f9906c56ac72fc4f13218dd90bdf9bc8a248b (diff) | |
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 8c5f9906c56ac72fc4f13218dd90bdf9bc8a248b.
Diffstat (limited to 'django/db/models/sql')
| -rw-r--r-- | django/db/models/sql/compiler.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py index 3cab405d2d..52ea717ca6 100644 --- a/django/db/models/sql/compiler.py +++ b/django/db/models/sql/compiler.py @@ -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 |
