vendredi 23 juillet 2021

Combine one-to-one and many-to-many (django)

I have a model named "db_connector" and another one "project_site".


A "project_site" can have many to many relation with "db-connector". But the "project_site" should have one default db-connector.


What is the best design-pattern for this? Can I combine many to many and one to one like this: Many to many relation for alternative connectors linked to a project_site and one to one for the default connector linked to a project_site?

The user can specify a db_connector, if the user doesn't specify a database_conector, the default db_connector can be used?

Aucun commentaire:

Enregistrer un commentaire