#10227: OneToOne fields with null=True raise DoesNotExist exception on related
model
-------------------------------------+-------------------------------------
     Reporter:  rvdrijst             |                    Owner:  nobody
         Type:  New feature          |                   Status:  new
    Component:  Database layer       |                  Version:  SVN
  (models, ORM)                      |               Resolution:
     Severity:  Normal               |             Triage Stage:  Accepted
     Keywords:  onetoone related     |      Needs documentation:  0
  expection null                     |  Patch needs improvement:  0
    Has patch:  0                    |                    UI/UX:  0
  Needs tests:  0                    |
Easy pickings:  0                    |
-------------------------------------+-------------------------------------

Comment (by lrekucki):

 Replying to [comment:18 sebastian]:
 > Alright, here is another inconsistent behavior that falls in the lines
 of raising or not raising an exception.
 >
 > The behavior of the reverse lookup for one-to-one-fields changes when
 `select_related` has been called on the reverse relation. In that case,
 accessing the reverse relation does not raise an exception but returns
 `None` in the case of a missing related object. This feels rather strange
 to me, it should either always raise an exception or never.

 This is a bug described in #13839. In context of this ticket, it should
 always raise an exception, unless {{{related_null=True}}} is given, in
 which case it should always return {{{None}}}.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/10227#comment:19>
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 post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to