mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
queryset-refactor: Implemented slicing to end of querysets.
Refs #2150, #5012. git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7147 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -422,6 +422,14 @@ This returns the sixth through tenth objects (``OFFSET 5 LIMIT 5``)::
|
||||
|
||||
Entry.objects.all()[5:10]
|
||||
|
||||
You can also slice from the item ''N'' to the end of the queryset. For
|
||||
example, to return everything from the fixth item onwards::
|
||||
|
||||
Entry.objects.all()[5:]
|
||||
|
||||
How this last example is implemented in SQL varies depending upon the database
|
||||
used, but it is supported in all cases.
|
||||
|
||||
Generally, slicing a ``QuerySet`` returns a new ``QuerySet`` -- it doesn't
|
||||
evaluate the query. An exception is if you use the "step" parameter of Python
|
||||
slice syntax. For example, this would actually execute the query in order to
|
||||
|
||||
Reference in New Issue
Block a user