1. Luke Plant
  2. django


Luke Plant  committed ba6b211

Updated docs regarding QuerySet slicing and IndexError, in line with r2859

  • Participants
  • Parent commits 688b075
  • Branches default

Comments (0)

Files changed (1)

File docs/db-api.txt

View file
 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::
-This is equivalent to::
+This is roughly equivalent to::
-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