diff options
| author | Adam KalinĚski <adamkalinski@gmail.com> | 2014-02-22 20:29:55 +0100 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2014-03-24 09:41:04 -0400 |
| commit | ec08d62a20f55cfdfb9fbd21d8bc5627c54337c7 (patch) | |
| tree | 2b7702a5793b6f11e8c51a8e3b9dec511f583eff /docs/ref | |
| parent | 60d2dde2867dc91a5b93bf1d03799c6d043da8fb (diff) | |
Fixed #22048 - Enhanced docs to cover nonexistent one-to-one relationships.
Thanks EvilDMP for the suggestion.
Diffstat (limited to 'docs/ref')
| -rw-r--r-- | docs/ref/models/fields.txt | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt index feaf846b24..3a43d51560 100644 --- a/docs/ref/models/fields.txt +++ b/docs/ref/models/fields.txt @@ -1469,6 +1469,15 @@ 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``:: + + >>> user.supervisor_of + Traceback (most recent call last): + ... + DoesNotExist: User matching query does not exist. + .. _onetoone-arguments: Additionally, ``OneToOneField`` accepts all of the extra arguments |
