Hi there ...

Suppose I have three Models:

Model A

Model B, has a M2M with Model A

Model C, has M2Ms with both Model A and Model B

What I'm trying to do is to construct a query which will answer the
following question:  "For a given A, what Cs does it have a
relationship with, either through it's direct M2M or indirectly via
Model B's M2M with Model C".

I can do this piecemeal by getting the results from the A-C M2M, and
then for each A-B pair get that B's results, and then unioning
everything, but it'd be nice (and presumably The Right Way) to get it
all in one command.  It's this step that's confounding me.  I'm
guessing it requires using Q, but I still can't quite figure out the
right magic to make this work.

Thanks
-J
--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to