[Answered ]-Unsure how to correctly use Django models for a relationship with extra info



but this seems incorrect to me because the Relationship model does not represent an object but a relation between other objects.

A relationship is a first-class thing.

In a simple RDBMS models, the relationship was implied by a shared key (FK in one, PK in another)

However, when you have many-to-many association tables, you create an explicit row which embodies the relationship.

You’re just enriching the association object with additional attributes.

This is fine. It’s common, in fact.

It’s a generalization of this: https://docs.djangoproject.com/en/1.3/topics/db/models/#many-to-many-relationships

Also, read this: https://docs.djangoproject.com/en/1.3/topics/db/models/#extra-fields-on-many-to-many-relationships


Leave a comment