views:

318

answers:

1

Hi,

I have a model Model with a m2m field :

user = .. fk user
...
watchers = models.ManyToManyField(User, related_name="boardShot_watchers",  null=True)

How do i select all distinct Users involved in this watchers relationship for all my entries of type Model ?

I dont think there is an ORM way to access to intermediary M2M table.

Greg

+2  A: 

Not in your current model. If you want to have explicit access to the joining table, you need to make it part of the Django object model. The docs explain how to do this:

http://www.djangoproject.com/documentation/models/m2m_intermediary/

The admin and other django.contrib* components can be configured to treat most fields the same as if they were just model.ManyToMany's. But it will take a little config.

kkubasik
Hum i will do this then, better than raw sql
coulix