[patch] Backwards relations (ie. xxx_set) across different apps needs voodoo magic to work
|Reported by:||parlar@…||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)
Changed 10 years ago by russellm
comment:2 Changed 10 years ago by russellm
- Owner changed from adrian to russellm
- Status changed from new to assigned
- Summary changed from Backwards relations (ie. xxx_set) across different apps needs voodoo magic to work to [patch] Backwards relations (ie. xxx_set) across different apps needs voodoo magic to work
- Version set to SVN
comment:6 Changed 9 years ago by SmileyChris
- Patch needs improvement set
- Triage Stage changed from Unreviewed to Accepted
comment:7 Changed 9 years ago by oggie_rob
- Owner changed from nobody to oggie_rob
- Status changed from assigned to new