From 8d03356d35a91e2a8536bae4319f061ccf6c0294 Mon Sep 17 00:00:00 2001 From: Simon Charette Date: Thu, 8 Feb 2018 09:59:25 -0500 Subject: [2.0.x] Fixed #29108 -- Fixed crash in aggregation of distinct+ordered+sliced querysets. Regression in 4acae21846f6212aa992763e587c7e201828d7b0. Thanks Stephen Brooks for the report. Backport of d61fe246015aa4fdc6dcb837ffb1442fa71ae586 from master --- tests/queries/tests.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tests') diff --git a/tests/queries/tests.py b/tests/queries/tests.py index 668b07361a..79bd8203ca 100644 --- a/tests/queries/tests.py +++ b/tests/queries/tests.py @@ -1891,6 +1891,9 @@ class Queries6Tests(TestCase): qs = Tag.objects.exclude(category=None).exclude(category__name='foo') self.assertEqual(str(qs.query).count(' INNER JOIN '), 1) + def test_distinct_ordered_sliced_subquery_aggregation(self): + self.assertEqual(Tag.objects.distinct().order_by('category__name')[:3].count(), 3) + class RawQueriesTests(TestCase): def setUp(self): -- cgit v1.3