mirror of
https://github.com/django/django.git
synced 2025-07-21 10:09:14 +00:00
[1.0.X] Fixed #9420 -- Fixed an exception type in the documentation of
Queryset.get(). Based on a suggestion from daveyjoe. Backport of r9257 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@9261 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
568cb5d87c
commit
8cf2a05d35
@ -743,11 +743,13 @@ they query the database each time they're called.
|
|||||||
Returns the object matching the given lookup parameters, which should be in
|
Returns the object matching the given lookup parameters, which should be in
|
||||||
the format described in `Field lookups`_.
|
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.
|
||||||
|
|
||||||
``get()`` raises a ``DoesNotExist`` exception if an object wasn't found for the
|
``get()`` raises a ``DoesNotExist`` exception if an object wasn't found for
|
||||||
given parameters. The ``DoesNotExist`` exception is an attribute of the model
|
the given parameters. This exception is also an attribute of the model class.
|
||||||
class. Example::
|
Example::
|
||||||
|
|
||||||
Entry.objects.get(id='foo') # raises Entry.DoesNotExist
|
Entry.objects.get(id='foo') # raises Entry.DoesNotExist
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user