Tuesday, December 27, 2011

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

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 model where all deep references to and from the
instance that are TaskMeta instances have status=SUCCESS. Currently, I
am able to perform said operation for all relations from a given
model, but the other way -- to a given model. http://paste.pocoo.org/show/526681/

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment