Incorrect reverse one-to-one lookup on unsaved objects
|Reported by:||Aymeric Augustin||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||1.4|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Let's assume two models,
A has a nullable one-to-one relation to
Let's create a single instance of
A in the database, with no related
a.b_id = None).
Now let's instanciate a
B without saving it (
b.id = None).
At this point,
b.a incorrectly returns the instance of a created above -- because it's the only
a.b_id == b.id.
b.a should raise