When setting the FK of a MappedForeignKey its _obj should not be uncached unless its incorrect
See #165.
When the currently cached obj's PK matches the new FK, it should not be uncached.
The current behavior interacts badly with the current implementation of MappedOneToMany.save, which sets some of its children's FK. Subsequently calling obj on the child will reload a new instance of its parent. Thus the child cannot be relied upon to remove itself from its parent (via OneToMany) because it will be pending deletion on the wrong parent instance.
Admittedly this is a corner case but the situation could be improved.
When the currently cached obj's PK matches the new FK, it should not be uncached.
The current behavior interacts badly with the current implementation of MappedOneToMany.save, which sets some of its children's FK. Subsequently calling obj on the child will reload a new instance of its parent. Thus the child cannot be relied upon to remove itself from its parent (via OneToMany) because it will be pending deletion on the wrong parent instance.
Admittedly this is a corner case but the situation could be improved.
Leave a comment
(In revision:f7824cfa4963a43c3cba9d3d9d1ddcd780b17533) Closes #370. Improved cache invalidation for foreign key references
Branch: master
Branch: master