diff options
| author | Adam Johnson <me@adamj.eu> | 2020-07-15 10:32:59 +0100 |
|---|---|---|
| committer | Adam Johnson <me@adamj.eu> | 2020-07-22 14:21:08 +0100 |
| commit | bc4fea92b296a7eacbd5f89263ca67515feeb53f (patch) | |
| tree | dc37976da617e65cec023c61a14dd8216294bdce /docs/ref/models/fields.txt | |
| parent | b5f0efa19c82d274082bcde8a8acae5038667614 (diff) | |
Doc'd Model.MultipleObjectsReturned docs and improved documentation related with models exceptions.
Diffstat (limited to 'docs/ref/models/fields.txt')
| -rw-r--r-- | docs/ref/models/fields.txt | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt index 4e3cd108b9..fd7e88d168 100644 --- a/docs/ref/models/fields.txt +++ b/docs/ref/models/fields.txt @@ -1999,14 +1999,16 @@ your resulting ``User`` model will have the following attributes:: >>> hasattr(user, 'supervisor_of') True -A ``DoesNotExist`` exception is raised when accessing the reverse relationship -if an entry in the related table doesn't exist. For example, if a user doesn't -have a supervisor designated by ``MySpecialUser``:: +A ``RelatedObjectDoesNotExist`` exception is raised when accessing the reverse +relationship if an entry in the related table doesn't exist. This is a subclass +of the target model's :exc:`Model.DoesNotExist +<django.db.models.Model.DoesNotExist>` exception. For example, if a user +doesn't have a supervisor designated by ``MySpecialUser``:: >>> user.supervisor_of Traceback (most recent call last): ... - DoesNotExist: User matching query does not exist. + RelatedObjectDoesNotExist: User has no supervisor_of. .. _onetoone-arguments: |
