Re: All models with FKs, M2Ms, or 121s pointing to a given model

2011-12-28 Thread JohnA
It's maybe not as rigorous as the explicitly _meta-based approach noted by Russ McGee, but I use straight introspection combined with a knowledge of naming conventions, as follows: # This function looks only at passed in object, not its derived subobjects # If you want items from the most derived

Re: All models with FKs, M2Ms, or 121s pointing to a given model

2011-12-27 Thread Russell Keith-Magee
On Wed, Dec 28, 2011 at 10:01 AM, Daniel Kaplun wrote: > How do I get all models with FKs, M2Ms, or 121s pointing to a given > model? Looking at your pastebin, you've already discovered the _meta object -- you just needed to dig around a little more in there. The methods/attributes

All models with FKs, M2Ms, or 121s pointing to a given model

2011-12-27 Thread Daniel Kaplun
How do I get all models with FKs, M2Ms, or 121s pointing to a given model? I am using djcelery. I have a BakedModel with a FK to TaskMeta, which is the model that stores task status (I only care whether it is complete). I want to generate a query set that will return all instances of a given