我正在將用戶的教育添加到他的用戶配置文件中。用戶可能有多個條目用於他的教育。我是否應該使用基本的M2M關係,例如 -是否在M2M關係中使用直通模型
class Education(models.Model):
school = models.CharField(max_length=100)
class_year = models.IntegerField(max_length=4, blank=True, null=True)
degree = models.CharField(max_length=100, blank=True, null=True)
class UserProfile(models.Model):
user = models.ForeignKey(User, unique=True)
educations = models.ManyToManyField(Education)
或者我應該爲這種關係使用直通模型?謝謝。