when inheriting models, accessing related subclass instances can produce spurious relations depending on order
|Reported by:||Andy MacKinlay||Owned by:||socrates|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
If you are using the new multi-table inheritance feature, and have two or more subclasses (eg SubClassA and SubClassB) which inherits from a baseclass, and retrieve a base class instance
baseinstance from the DB, the expected behaviour if
baseinstance only has a corresponding SubClassA instance should be to throw a DoesNotExist exception when accessing
baseinstance.subclassb. However, if you have already accessed
baseinstance.subclassb will point to the corresponding SubClassA instance instead of raising the exception.
The attached models.py includes a test case that documents this.