The type field on Membership rules out m2m. There's a patch in the works (6095) to address this, and it could use testing, if you'd like to try it out.
Alternatively, set up a many to one from membership to user, and from membership to group, and call the backrefs "groups" and "users" respectively. User.groups.group.all() gives you the groups associated with the user table. Group.users.user.all() gives you the users associated with the group table. It looks like Message should have a foreign key to Membership rather than separate ones to User and Group, if I'm reading your intentions correctly. Cheers, Cliff On Tue, 2008-02-12 at 23:48 -0600, Alex Ezell wrote: > This doesn't answer your question directly, but wouldn't many-to-many > fields help a bit here? > > http://www.djangoproject.com/documentation/model-api/#many-to-many-relationships > > Sorry if you've already thought about this and dismissed it. > > /alex > > On Feb 12, 2008 11:41 PM, Gus <[EMAIL PROTECTED]> wrote: > > > > Hi all, > > I have something like: > > > > Class User > > id > > > > Class Group > > id > > > > Class Membership > > id > > group fk > > user fk > > type char1 > > > > Class Message > > id > > group fk > > user fk > > > > I'm a little confused about how to do this join from the django db > > api: > > > > select message.* from message, membership > > where message.group_id = membership.group_id > > AND message.user_id = membership.user_id > > AND membership.type <> 'B' > > > > I basically want all the messages where the related membership type is > > not 'B'... > > > > any help would be much appreciated > > > > > > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---