diff options
| author | Matthias Erll <matthias@precisdigital.com> | 2014-05-17 14:59:57 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-05-31 19:34:56 -0400 |
| commit | eee34ef64c026e3274c6d1b4fa2baffbc956b954 (patch) | |
| tree | 1ed5087f7396fafc49560e8106cf23c6d1afd99c /tests/ordering | |
| parent | 84fb50df670c8126983c9f0fd4a5c30dbe57b684 (diff) | |
Fixed #22550 -- Prohibited QuerySet.last()/reverse() after slicing.
Diffstat (limited to 'tests/ordering')
| -rw-r--r-- | tests/ordering/tests.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/ordering/tests.py b/tests/ordering/tests.py index de49626cf4..ff749331b9 100644 --- a/tests/ordering/tests.py +++ b/tests/ordering/tests.py @@ -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 |
