Using Django’s built in models, how would one create a triple-join between three models.
For example:
- Users, Roles, and Events are the models.
- Users have many Roles, and Roles many Users. (ManyToMany)
- Events have many Users, and Users many Events. (ManyToMany)
- But for any given Event, any User may have only one Role.
How can this be represented in the model?
zacherates writes:
I’d also reccomed this solution, but you can also make use of some syntactical sugar provided by Django: ManyToMany relation with extra fields.
Example: