diff options
| author | Simon Charette <charette.s@gmail.com> | 2023-02-27 01:10:19 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-27 07:10:19 +0100 |
| commit | b15f162f252610e3b510ade465549769ab4356cf (patch) | |
| tree | 76647400905e8d5b9b54f2330bbf22fcd45b6253 /tests/ordering | |
| parent | 2276ec8c21655b05bb44e14e236b499aa5d01f5b (diff) | |
Fixed #34372 -- Fixed queryset crash on order by aggregation using OrderBy.
Regression in 278881e37619278789942513916acafaa88d26f3 caused by a lack
of expression copying when an OrderBy expression is explicitly provided.
Thanks Jannis Vajen for the report and regression test.
Diffstat (limited to 'tests/ordering')
| -rw-r--r-- | tests/ordering/tests.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/ordering/tests.py b/tests/ordering/tests.py index 7ff38acc4a..b29404ed77 100644 --- a/tests/ordering/tests.py +++ b/tests/ordering/tests.py @@ -638,3 +638,9 @@ class OrderingTests(TestCase): .first(), self.a1, ) + + def test_order_by_expr_query_reuse(self): + qs = Author.objects.annotate(num=Count("article")).order_by( + F("num").desc(), "pk" + ) + self.assertCountEqual(qs, qs.iterator()) |
