[Answered ]-Django: ManyToManyField with additional Column

2👍

through is what you need to use, e.g.

class softwareskill_model(django.db.models.Model):
    name = django.db.models.CharField(max_length=200)

class application_model(django.db.models.Model):
    # ...
    softwareskills = django.db.models.ManyToManyField(softwareskill_model, through="ApplicationSoftwareSkill")

class ApplicationSoftwareSkill(models.Model):
    softwareskill = models.ForeignKey(softwareskill_model)
    application = models.ForeignKey(application_model)
    # extra fields here e.g.
    rating = models.IntegerField()
👤JamesO

Leave a comment