From 7355fa6b728357a3e7257fbe1175d68a0d7e2ec1 Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Sat, 23 Feb 2008 01:34:49 +0000 Subject: 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 --- docs/db-api.txt | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'docs') 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 -- cgit v1.3