mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Fixed #22550 -- Prohibited QuerySet.last()/reverse() after slicing.
This commit is contained in:
committed by
Tim Graham
parent
84fb50df67
commit
eee34ef64c
@@ -203,6 +203,14 @@ class OrderingTests(TestCase):
|
||||
attrgetter("headline")
|
||||
)
|
||||
|
||||
def test_no_reordering_after_slicing(self):
|
||||
msg = 'Cannot reverse a query once a slice has been taken.'
|
||||
qs = Article.objects.all()[0:2]
|
||||
with self.assertRaisesMessage(TypeError, msg):
|
||||
qs.reverse()
|
||||
with self.assertRaisesMessage(TypeError, msg):
|
||||
qs.last()
|
||||
|
||||
def test_extra_ordering(self):
|
||||
"""
|
||||
Ordering can be based on fields included from an 'extra' clause
|
||||
|
||||
Reference in New Issue
Block a user