I have an existing PostgreSQL database with a many to many relationship, it is handled through a join table as below.
I'm looking to apply the ManyToMany Field type, does this bypass this join/intermediate table? How do I correctly configure it in my models.py? I'd rather keep the intermediate table.
# models.py
class Sample(models.Model):
sample_id = models.AutoField(primary_key=True)
...
class JoinSampleContainer(models.Model):
id = models.AutoField(primary_key=True)
container_id = models.ForeignKey(Container, db_column='container_id', on_delete = models.PROTECT)
sample_id = models.ForeignKey(Sample, db_column='sample_id', on_delete = models.PROTECT)
...
class Container(models.Model):
container_id = models.AutoField(primary_key=True)