#30309: Remove hasattr reference in One-to-One documentation example
-------------------------------+--------------------------------------
Reporter: David Beitey | Owner: nobody
Type: Uncategorized | Status: closed
Component: Documentation | Version: 2.2
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Comment (by Simon Charette):
FWIW this scenario can also happen when using
`on_delete=models.DO_NOTHING, db_constraint=False` and an attempt is made
to access a remote object that has been deleted.
I'd be in favor of making `ForwardManyToOneDescriptor.get_object` raise
`self.RelatedObjectDoesNotExist` as the current code clearly doesn't take
`db_constraint=False` into account based on
[https://github.com/django/django/blob/755673e1bca7edb6bee7a958f40d9ae54d85d44c/django/db/models/fields/related_descriptors.py#L144
the heuristic comment there].
--
Ticket URL: <https://code.djangoproject.com/ticket/30309#comment:6>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/065.38c976170be8fb703658822bd078f3f4%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.