How about: a = A.objects.get(pk=1) c = C.objects.filter(Q(a__exact = a) | Q(b__a__exact = a)).distinct() hth, -richard
On 4/14/08, Jeff Gentry <[EMAIL PROTECTED]> wrote: > > > I have a setup that I figured I could just crib off of the > User/Group/Permission code because the setup is basically identical, but > falling a bit short here (perhaps I'm just not looking at the right code). > > I have three classes, As, Bs & Cs. > > A has a M2M relationship with both B & C. > B has a M2M relationship with C. > > For any given instance of A, I want to see all of its C's - either > directly via its M2M or inherited via its Bs. You can see why I said this > is basically identical to the user/group/permission setup. > > I looked at django.contrib.auth.models and Group has a M2M > "permissions" and User has a M2M user_permissions, but all of the code > that I found referencing a user's effective permission set is going out to > the auth backends which I'm sure is not really what I want to do here. Is > there another place to look to find the best way to get what I want? > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---