From 42e8f264ce55710056b0033682ec6fd662a25b29 Mon Sep 17 00:00:00 2001 From: Simon Charette Date: Tue, 7 Jan 2025 00:02:31 -0500 Subject: Fixed #36065 -- Fixed ordering by expression referencing composite primary key. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thanks Jacob Walls for the report and test and Csirmaz Bendegúz for the review. --- django/db/models/sql/compiler.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'django/db/models/sql/compiler.py') diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py index 5bb491d823..251cc08e51 100644 --- a/django/db/models/sql/compiler.py +++ b/django/db/models/sql/compiler.py @@ -1117,10 +1117,9 @@ class SQLCompiler: ) return results targets, alias, _ = self.query.trim_joins(targets, joins, path) - target_fields = composite.unnest(targets) return [ (OrderBy(transform_function(t, alias), descending=descending), False) - for t in target_fields + for t in targets ] def _setup_joins(self, pieces, opts, alias): -- cgit v1.3