mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Made negative indexing on QuerySet instances raise an assertion error (previously
it just returned incorrect results). git-svn-id: http://code.djangoproject.com/svn/django/trunk@2992 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -283,6 +283,16 @@ Traceback (most recent call last):
|
||||
...
|
||||
AssertionError: Cannot combine queries once a slice has been taken.
|
||||
|
||||
# Negative slices are not supported, due to database constraints.
|
||||
# (hint: inverting your ordering might do what you need).
|
||||
>>> Article.objects.all()[-1]
|
||||
Traceback (most recent call last):
|
||||
...
|
||||
AssertionError: Negative indexing is not supported.
|
||||
>>> Article.objects.all()[0:-5]
|
||||
Traceback (most recent call last):
|
||||
...
|
||||
AssertionError: Negative indexing is not supported.
|
||||
|
||||
# An Article instance doesn't have access to the "objects" attribute.
|
||||
# That's only available on the class.
|
||||
|
||||
Reference in New Issue
Block a user