summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2008-05-29 11:56:32 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2008-05-29 11:56:32 +0000
commit6b39dd6977031c2ea9fed26ebfc5ea90b570c3cb (patch)
tree6203316c69979b25652121ac2aadbca309c78f5d /docs
parent8a0b8d93b2aa88c0d5bd70a2637ebb05c04fcca8 (diff)
Fixed #7260 -- Corrected the description of the exception returned by get() when multiple objects match the search criteria. Thanks, leotr.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7559 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
-rw-r--r--docs/db-api.txt7
1 files changed, 6 insertions, 1 deletions
diff --git a/docs/db-api.txt b/docs/db-api.txt
index 405ed87cef..a15c45d37b 100644
--- a/docs/db-api.txt
+++ b/docs/db-api.txt
@@ -1061,7 +1061,12 @@ they query the database each time they're called.
Returns the object matching the given lookup parameters, which should be in
the format described in `Field lookups`_.
-``get()`` raises ``AssertionError`` if more than one object was found.
+``get()`` raises ``MultipleObjectsReturned`` if more than one object was found.
+The ``MultipleObjectsReturned`` exception is an attribute of the model class.
+For example, the following will raise ``MultipleObjectsReturned`` if there
+are more than one authors with the name of 'John'::
+
+ Author.objects.get(name='John') # raises Author.MultipleObjectsReturned
``get()`` raises a ``DoesNotExist`` exception if an object wasn't found for the
given parameters. The ``DoesNotExist`` exception is an attribute of the model