<p>Using Django's built in models, how would one create a triple-join between three models.</p>

<p>For example:</p>

<ul>
<li>Users, Roles, and Events are the models.</li>
<li>Users have many Roles, and Roles many Users.  (ManyToMany)</li>
<li>Events have many Users, and Users many Events. (ManyToMany)</li>
<li>But for any given Event, any User may have only one Role.</li>
</ul>

<p>How can this be represented in the model?</p>

I'd recommend just creating an entirely separate model for this.
```
```
class Assignment(Model):
    user = ForeignKey(User)
    role = ForeignKey(Role)
    event = ForeignKey(Event)
```
```
This lets you do all the usual model stuff, such as
```
```
user.assignment_set.filter(role__name="Chaperon")
role.assignment_set.filter(event__name="Silly Walkathon")
```
```
The only thing left is to enforce your one-role-per-user-per-event restriction.  You can do this in the Assignment class by either overriding the save method (
http://docs.djangoproject.com/en/dev/topics/db/models/#overriding-predefined-model-methods
) or using signals (
http://docs.djangoproject.com/en/dev/topics/signals/
)