mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #24747 -- Allowed transforms in QuerySet.order_by() and distinct(*fields).
This commit is contained in:
committed by
Tim Graham
parent
bf26f66029
commit
2162f0983d
@@ -309,6 +309,22 @@ class TestQuerying(PostgreSQLTestCase):
|
||||
self.objs[2:3]
|
||||
)
|
||||
|
||||
def test_order_by_slice(self):
|
||||
more_objs = (
|
||||
NullableIntegerArrayModel.objects.create(field=[1, 637]),
|
||||
NullableIntegerArrayModel.objects.create(field=[2, 1]),
|
||||
NullableIntegerArrayModel.objects.create(field=[3, -98123]),
|
||||
NullableIntegerArrayModel.objects.create(field=[4, 2]),
|
||||
)
|
||||
self.assertSequenceEqual(
|
||||
NullableIntegerArrayModel.objects.order_by('field__1'),
|
||||
[
|
||||
more_objs[2], more_objs[1], more_objs[3], self.objs[2],
|
||||
self.objs[3], more_objs[0], self.objs[4], self.objs[1],
|
||||
self.objs[0],
|
||||
]
|
||||
)
|
||||
|
||||
@unittest.expectedFailure
|
||||
def test_slice_nested(self):
|
||||
instance = NestedIntegerArrayModel.objects.create(field=[[1, 2], [3, 4]])
|
||||
|
||||
Reference in New Issue
Block a user