#25349: ModelForm regression when setting None into a ForeignKey
-------------------------------+--------------------------------------
Reporter: jpaulett | Owner: nobody
Type: Uncategorized | Status: new
Component: Forms | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by jpaulett):
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Comment:
It appears that adding `blank=True` to the model's field definition
results in the expected behaviour.
Conceptually, it does make sense that at the model level, I'm allowing
blank values. However, it seems a bit surprising that the original
apparent illogical combination (blank=False, required=False) does not
result in a validation error or system check warning, thus keeping the
prior value in the field.
Should this result in a ValidationError? Or perhaps a small note in the
1.8 release notes to state that for ModelForms with required=False
ModelChoiceFields, that blank=True is required on the model's ForeignKey
field?
I'd be happy to assist, but just seek clarification on intended / desired
behaviour in this case.
--
Ticket URL: <https://code.djangoproject.com/ticket/25349#comment:1>
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/066.a1fde7d5217b19d1609d1a3e097c6970%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.