#12708: Django raises DoesNotExist when consulting an empty ForeignKey field
-------------------------------------+-------------------------------------
Reporter: lsaffre | Owner: nobody
Type: Uncategorized | Status: closed
Component: Database layer | Version: master
(models, ORM) | Resolution: invalid
Severity: Normal | Triage Stage:
Keywords: ForeignKey | Unreviewed
DoesNotExist | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Comment (by lsaffre):
Thanks for the example of a possible incompatibility. Yes of course, such
code will break. The suggested change is not backward-compatible.
No it was not "proactive (think paranoid) to check for None" in a non-
nullable field of an unsaved instance. There are even people who say that
the opposite is true: expecting an exception for an expectable condition
is considered bad style. The essence of this ticket is to (1) admit that
the current behaviour is wrong (e.g. by agreeing to the statement "Django
should raise an exception only when I try to save the instance, not
already when I want to see the value of `journal`!"). Luis understood this
and illustrated it beautifully. And only then we can start to (2) collect
ideas about how to change it. We will never get ideas about (2) as long as
we don't admit (1).
--
Ticket URL: <https://code.djangoproject.com/ticket/12708#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.a4524bfa982667d82f0003e6cad903c5%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.