summaryrefslogtreecommitdiff
path: root/tests/distinct_on_fields
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2015-07-09 13:52:32 -0400
committerSimon Charette <charette.s@gmail.com>2015-07-09 16:00:52 -0400
commit07577a2d05fc33ebef062f97a754dd53079356db (patch)
tree2d1a1a1b13c8e6707b8faf775131aab1194132ae /tests/distinct_on_fields
parent7b6d3104f263d9483982928604b2e51f06126ec1 (diff)
downloaddjango-07577a2d05fc33ebef062f97a754dd53079356db.tar.gz
Fixed #25081 -- Prevented DISTINCT ON ordering from being cleared in get().
Thanks to pdewacht for the patch.
Diffstat (limited to 'tests/distinct_on_fields')
-rw-r--r--tests/distinct_on_fields/tests.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/distinct_on_fields/tests.py b/tests/distinct_on_fields/tests.py
index 68290d7b8f..9e53ce3ae9 100644
--- a/tests/distinct_on_fields/tests.py
+++ b/tests/distinct_on_fields/tests.py
@@ -129,3 +129,11 @@ class DistinctOnTests(TestCase):
qs, [self.p1_o2, self.p2_o1, self.p3_o1],
lambda x: x
)
+
+ def test_distinct_on_get_ordering_preserved(self):
+ """
+ Ordering shouldn't be cleared when distinct on fields are specified.
+ refs #25081
+ """
+ staff = Staff.objects.distinct('name').order_by('name', '-organisation').get(name='p1')
+ self.assertEqual(staff.organisation, 'o2')