[patch] Backwards relations (ie. xxx_set) across different apps needs voodoo magic to work
|Reported by:||Owned by:||oggie_rob|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||yes|
As described (and temporarily solved) here: http://groups.google.com/group/django-users/browse_frm/thread/8b1f9699dd5c72d1/2663f422db6a027c?lnk=arm#2663f422db6a027c
In general, I have a Photo model and an Article model. They live in separate applications. The Article model has:
picture = models.ForeignKey(Photo)
The problem is that you can't access the 'article_set' attribute from a Photo instance *unless* you've already imported 'Article'.
Russell says that this is reasonably obvious if you know the internals, but it's definitely not documented.
So this should be properly documented, and if anyone can figure out how, a fix should be put in so you don't need to import the 'Article' model just to be able to access 'article_set' on a Photo instance.
Change History (9)
comment:2 Changed 11 years ago by
|Owner:||changed from Adrian Holovaty to Russell Keith-Magee|
|Status:||new → assigned|
|Summary:||Backwards relations (ie. xxx_set) across different apps needs voodoo magic to work → [patch] Backwards relations (ie. xxx_set) across different apps needs voodoo magic to work|