1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Doc'd Model.MultipleObjectsReturned docs and improved documentation related with models exceptions.

This commit is contained in:
Adam Johnson
2020-07-15 10:32:59 +01:00
parent b5f0efa19c
commit bc4fea92b2
4 changed files with 58 additions and 34 deletions

View File

@@ -25,6 +25,20 @@ Attributes
to catch exceptions for a particular model class. The exception is a
subclass of :exc:`django.core.exceptions.ObjectDoesNotExist`.
``MultipleObjectsReturned``
---------------------------
.. exception:: Model.MultipleObjectsReturned
This exception is raised by :meth:`.QuerySet.get` when multiple objects are
found for the given lookups.
Django provides a ``MultipleObjectsReturned`` exception as an attribute of
each model class to identify the class of object for which multiple objects
were found, allowing you to catch exceptions for a particular model class.
The exception is a subclass of
:exc:`django.core.exceptions.MultipleObjectsReturned`.
``objects``
-----------