Django

Code

Show
Ignore:
Timestamp:
05/29/08 06:56:32 (4 months ago)
Author:
russellm
Message:

Fixed #7260 -- Corrected the description of the exception returned by get() when multiple objects match the search criteria. Thanks, leotr.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/docs/db-api.txt

    r7499 r7559  
    10621062the format described in `Field lookups`_. 
    10631063 
    1064 ``get()`` raises ``AssertionError`` if more than one object was found. 
     1064``get()`` raises ``MultipleObjectsReturned`` if more than one object was found. 
     1065The ``MultipleObjectsReturned`` exception is an attribute of the model class. 
     1066For example, the following will raise ``MultipleObjectsReturned`` if there 
     1067are more than one authors with the name of 'John':: 
     1068 
     1069        Author.objects.get(name='John') # raises Author.MultipleObjectsReturned 
    10651070 
    10661071``get()`` raises a ``DoesNotExist`` exception if an object wasn't found for the