diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2008-02-23 01:34:49 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2008-02-23 01:34:49 +0000 |
| commit | 7355fa6b728357a3e7257fbe1175d68a0d7e2ec1 (patch) | |
| tree | 04f384b99607f4dd9e7ef94d1d2399dcfdbc891f /docs/db-api.txt | |
| parent | e2f524ca09bacef4545b56dc3f136655fa0b912c (diff) | |
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
Diffstat (limited to 'docs/db-api.txt')
| -rw-r--r-- | docs/db-api.txt | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/docs/db-api.txt b/docs/db-api.txt index 887a06a67e..d96541d58b 100644 --- a/docs/db-api.txt +++ b/docs/db-api.txt @@ -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 |
