diff options
author | Adam Johnson <me@adamj.eu> | 2020-07-22 11:11:58 +0200 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-07-22 20:22:06 +0200 |
commit | f026d761d63ecd10b937b8009b0ad59673f772b5 (patch) | |
tree | 0c1912c34d7703ea7af1041937ded093af46c39c | |
parent | dcb27ead84a91e8d38a183cfc2f7640141eb40f8 (diff) | |
download | django-f026d761d63ecd10b937b8009b0ad59673f772b5.tar.gz |
[3.0.x] Refs #24763 -- Moved DoesNotExist to Model class docs.
Backport of b5f0efa19c82d274082bcde8a8acae5038667614 from master
-rw-r--r-- | docs/ref/models/class.txt | 14 | ||||
-rw-r--r-- | docs/ref/models/instances.txt | 14 |
2 files changed, 14 insertions, 14 deletions
diff --git a/docs/ref/models/class.txt b/docs/ref/models/class.txt index 0183a82093..c41052788e 100644 --- a/docs/ref/models/class.txt +++ b/docs/ref/models/class.txt @@ -11,6 +11,20 @@ reference guides </ref/models/index>`. Attributes ========== +``DoesNotExist`` +---------------- + +.. exception:: Model.DoesNotExist + + This exception is raised by the ORM when an expected object is not found. + For example, :meth:`.QuerySet.get` will raise it when no object is found + for the given lookups. + + Django provides a ``DoesNotExist`` exception as an attribute of each model + class to identify the class of object that could not be found, allowing you + to catch exceptions for a particular model class. The exception is a + subclass of :exc:`django.core.exceptions.ObjectDoesNotExist`. + ``objects`` ----------- diff --git a/docs/ref/models/instances.txt b/docs/ref/models/instances.txt index b2f5aaa4a8..b439098674 100644 --- a/docs/ref/models/instances.txt +++ b/docs/ref/models/instances.txt @@ -841,20 +841,6 @@ duplicated. That also means you cannot use those methods on unsaved objects. Other attributes ================ -``DoesNotExist`` ----------------- - -.. exception:: Model.DoesNotExist - - This exception is raised by the ORM in a couple places, for example by - :meth:`QuerySet.get() <django.db.models.query.QuerySet.get>` when an object - is not found for the given query parameters. - - Django provides a ``DoesNotExist`` exception as an attribute of each model - class to identify the class of object that could not be found and to allow - you to catch a particular model class with ``try/except``. The exception is - a subclass of :exc:`django.core.exceptions.ObjectDoesNotExist`. - ``_state`` ---------- |