No error raised on update(foreignkey=unsavedobject) on nullable fk
|Reported by:||Afief||Owned by:||Aymeric Augustin|
|Component:||Database layer (models, ORM)||Version:||1.1|
|Has patch:||yes||Needs documentation:||yes|
|Needs tests:||no||Patch needs improvement:||no|
Found this while coding at 2AM:
When there is a field that can be NULL, and you do something like this:
django will assign the fields to NULL.
I'm not sure if this behaviour is made to be so by design, but it seems to me that if someone passes an unsaved object instead of None they made a mistake and django should raise an exception.
Change History (19)
comment:1 Changed 7 years ago by
|Patch needs improvement:||unset|
|Triage Stage:||Unreviewed → Accepted|