summaryrefslogtreecommitdiff
path: root/docs/db-api.txt
diff options
context:
space:
mode:
authorLuke Plant <L.Plant.98@cantab.net>2006-05-06 22:55:30 +0000
committerLuke Plant <L.Plant.98@cantab.net>2006-05-06 22:55:30 +0000
commit3c72a46f621d04189b48aba678e45fe3d23df5cb (patch)
tree05818865066ea9435eae52aef683fa25ebc79926 /docs/db-api.txt
parentdf668ee7825dc32d309c539bef13681541294451 (diff)
Updated docs regarding QuerySet slicing and IndexError, in line with r2859
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2862 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/db-api.txt')
-rw-r--r--docs/db-api.txt8
1 files changed, 4 insertions, 4 deletions
diff --git a/docs/db-api.txt b/docs/db-api.txt
index c207812081..e3303ea576 100644
--- a/docs/db-api.txt
+++ b/docs/db-api.txt
@@ -335,18 +335,18 @@ return a list of every *second* object of the first 10::
Entry.objects.all()[:10:2]
To retrieve a *single* object rather than a list
-(e.g. ``SELECT foo FROM bar LIMIT 1``), using a simple index instead of a
+(e.g. ``SELECT foo FROM bar LIMIT 1``), use a simple index instead of a
slice. For example, this returns the first ``Entry`` in the database, after
ordering entries alphabetically by headline::
Entry.objects.order_by('headline')[0]
-This is equivalent to::
+This is roughly equivalent to::
Entry.objects.order_by('headline')[0:1].get()
-Note that either of these two examples will raise ``DoesNotExist`` if no
-objects match the given criteria.
+Note, however, that the first of these will raise ``IndexError`` while the
+second will raise ``DoesNotExist`` if no objects match the given criteria.
QuerySet methods that return new QuerySets
------------------------------------------