Loading docs/ref/exceptions.txt +6 −14 Original line number Diff line number Diff line Loading @@ -12,25 +12,17 @@ Django Core Exceptions Django core exception classes are defined in ``django.core.exceptions``. ``ObjectDoesNotExist`` and ``DoesNotExist`` ------------------------------------------- .. exception:: DoesNotExist The ``DoesNotExist`` exception is raised when an object is not found for the given parameters of a query. 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``. ``ObjectDoesNotExist`` ---------------------- .. exception:: ObjectDoesNotExist The base class for ``DoesNotExist`` exceptions; a ``try/except`` for ``ObjectDoesNotExist`` will catch ``DoesNotExist`` exceptions for all models. The base class for :exc:`~django.db.models.Model.DoesNotExist` exceptions; a ``try/except`` for ``ObjectDoesNotExist`` will catch :exc:`~django.db.models.Model.DoesNotExist` exceptions for all models. See :meth:`~django.db.models.query.QuerySet.get()` for further information on :exc:`ObjectDoesNotExist` and :exc:`DoesNotExist`. on :exc:`ObjectDoesNotExist` and :exc:`~django.db.models.Model.DoesNotExist`. ``FieldDoesNotExist`` --------------------- Loading docs/ref/models/instances.txt +18 −1 Original line number Diff line number Diff line Loading @@ -826,7 +826,7 @@ For every :class:`~django.db.models.DateField` and <django.db.models.Field.null>`, the object will have ``get_next_by_FOO()`` and ``get_previous_by_FOO()`` methods, where ``FOO`` is the name of the field. This returns the next and previous object with respect to the date field, raising a :exc:`~django.core.exceptions.DoesNotExist` exception when appropriate. a :exc:`~django.db.models.Model.DoesNotExist` exception when appropriate. Both of these methods will perform their queries using the default manager for the model. If you need to emulate filtering used by a Loading @@ -837,3 +837,20 @@ format described in :ref:`Field lookups <field-lookups>`. Note that in the case of identical date values, these methods will use the primary key as a tie-breaker. This guarantees that no records are skipped or 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`. docs/ref/models/querysets.txt +6 −6 Original line number Diff line number Diff line Loading @@ -1578,15 +1578,15 @@ than one object was found. The :exc:`~django.core.exceptions.MultipleObjectsReturned` exception is an attribute of the model class. ``get()`` raises a :exc:`~django.core.exceptions.DoesNotExist` exception if an object wasn't found for the given parameters. This exception is also an attribute of the model class. Example:: ``get()`` raises a :exc:`~django.db.models.Model.DoesNotExist` exception if an object wasn't found for the given parameters. This exception is an attribute of the model class. Example:: Entry.objects.get(id='foo') # raises Entry.DoesNotExist The :exc:`~django.core.exceptions.DoesNotExist` exception inherits from The :exc:`~django.db.models.Model.DoesNotExist` exception inherits from :exc:`django.core.exceptions.ObjectDoesNotExist`, so you can target multiple :exc:`~django.core.exceptions.DoesNotExist` exceptions. Example:: :exc:`~django.db.models.Model.DoesNotExist` exceptions. Example:: from django.core.exceptions import ObjectDoesNotExist try: Loading Loading @@ -1905,7 +1905,7 @@ If your model's :ref:`Meta <meta-options>` specifies field specified in :attr:`~django.db.models.Options.get_latest_by` by default. Like :meth:`get()`, ``earliest()`` and ``latest()`` raise :exc:`~django.core.exceptions.DoesNotExist` if there is no object with the :exc:`~django.db.models.Model.DoesNotExist` if there is no object with the given parameters. Note that ``earliest()`` and ``latest()`` exist purely for convenience and Loading docs/releases/1.5.txt +1 −1 Original line number Diff line number Diff line Loading @@ -712,7 +712,7 @@ Miscellaneous * Accessing reverse one-to-one relations fetched via :meth:`~django.db.models.query.QuerySet.select_related` now raises :exc:`~django.core.exceptions.DoesNotExist` instead of returning ``None``. :exc:`~django.db.models.Model.DoesNotExist` instead of returning ``None``. .. _deprecated-features-1.5: Loading docs/releases/1.6.txt +1 −1 Original line number Diff line number Diff line Loading @@ -315,7 +315,7 @@ Minor features a ``SuspiciousOperation`` reaches the WSGI handler to return an ``HttpResponseBadRequest``. * The :exc:`~django.core.exceptions.DoesNotExist` exception now includes a * The :exc:`~django.db.models.Model.DoesNotExist` exception now includes a message indicating the name of the attribute used for the lookup. * The :meth:`~django.db.models.query.QuerySet.get_or_create` method no longer Loading Loading
docs/ref/exceptions.txt +6 −14 Original line number Diff line number Diff line Loading @@ -12,25 +12,17 @@ Django Core Exceptions Django core exception classes are defined in ``django.core.exceptions``. ``ObjectDoesNotExist`` and ``DoesNotExist`` ------------------------------------------- .. exception:: DoesNotExist The ``DoesNotExist`` exception is raised when an object is not found for the given parameters of a query. 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``. ``ObjectDoesNotExist`` ---------------------- .. exception:: ObjectDoesNotExist The base class for ``DoesNotExist`` exceptions; a ``try/except`` for ``ObjectDoesNotExist`` will catch ``DoesNotExist`` exceptions for all models. The base class for :exc:`~django.db.models.Model.DoesNotExist` exceptions; a ``try/except`` for ``ObjectDoesNotExist`` will catch :exc:`~django.db.models.Model.DoesNotExist` exceptions for all models. See :meth:`~django.db.models.query.QuerySet.get()` for further information on :exc:`ObjectDoesNotExist` and :exc:`DoesNotExist`. on :exc:`ObjectDoesNotExist` and :exc:`~django.db.models.Model.DoesNotExist`. ``FieldDoesNotExist`` --------------------- Loading
docs/ref/models/instances.txt +18 −1 Original line number Diff line number Diff line Loading @@ -826,7 +826,7 @@ For every :class:`~django.db.models.DateField` and <django.db.models.Field.null>`, the object will have ``get_next_by_FOO()`` and ``get_previous_by_FOO()`` methods, where ``FOO`` is the name of the field. This returns the next and previous object with respect to the date field, raising a :exc:`~django.core.exceptions.DoesNotExist` exception when appropriate. a :exc:`~django.db.models.Model.DoesNotExist` exception when appropriate. Both of these methods will perform their queries using the default manager for the model. If you need to emulate filtering used by a Loading @@ -837,3 +837,20 @@ format described in :ref:`Field lookups <field-lookups>`. Note that in the case of identical date values, these methods will use the primary key as a tie-breaker. This guarantees that no records are skipped or 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`.
docs/ref/models/querysets.txt +6 −6 Original line number Diff line number Diff line Loading @@ -1578,15 +1578,15 @@ than one object was found. The :exc:`~django.core.exceptions.MultipleObjectsReturned` exception is an attribute of the model class. ``get()`` raises a :exc:`~django.core.exceptions.DoesNotExist` exception if an object wasn't found for the given parameters. This exception is also an attribute of the model class. Example:: ``get()`` raises a :exc:`~django.db.models.Model.DoesNotExist` exception if an object wasn't found for the given parameters. This exception is an attribute of the model class. Example:: Entry.objects.get(id='foo') # raises Entry.DoesNotExist The :exc:`~django.core.exceptions.DoesNotExist` exception inherits from The :exc:`~django.db.models.Model.DoesNotExist` exception inherits from :exc:`django.core.exceptions.ObjectDoesNotExist`, so you can target multiple :exc:`~django.core.exceptions.DoesNotExist` exceptions. Example:: :exc:`~django.db.models.Model.DoesNotExist` exceptions. Example:: from django.core.exceptions import ObjectDoesNotExist try: Loading Loading @@ -1905,7 +1905,7 @@ If your model's :ref:`Meta <meta-options>` specifies field specified in :attr:`~django.db.models.Options.get_latest_by` by default. Like :meth:`get()`, ``earliest()`` and ``latest()`` raise :exc:`~django.core.exceptions.DoesNotExist` if there is no object with the :exc:`~django.db.models.Model.DoesNotExist` if there is no object with the given parameters. Note that ``earliest()`` and ``latest()`` exist purely for convenience and Loading
docs/releases/1.5.txt +1 −1 Original line number Diff line number Diff line Loading @@ -712,7 +712,7 @@ Miscellaneous * Accessing reverse one-to-one relations fetched via :meth:`~django.db.models.query.QuerySet.select_related` now raises :exc:`~django.core.exceptions.DoesNotExist` instead of returning ``None``. :exc:`~django.db.models.Model.DoesNotExist` instead of returning ``None``. .. _deprecated-features-1.5: Loading
docs/releases/1.6.txt +1 −1 Original line number Diff line number Diff line Loading @@ -315,7 +315,7 @@ Minor features a ``SuspiciousOperation`` reaches the WSGI handler to return an ``HttpResponseBadRequest``. * The :exc:`~django.core.exceptions.DoesNotExist` exception now includes a * The :exc:`~django.db.models.Model.DoesNotExist` exception now includes a message indicating the name of the attribute used for the lookup. * The :meth:`~django.db.models.query.QuerySet.get_or_create` method no longer Loading