如何创建依赖多重选择(ManyToManyField)

时间:2014-07-08 11:14:53

标签: python django

Class Specialization(models.Model):
    spec_name = models.CharField(max_length=200)

Class StudentGroup(models.Model):
    sg_number = models.IntegerField()
    sg_spec = models.ForeignKey(Specialization)
    sg_count = models.IntegerField()

Class Schedule(models.Model):
    schedule_date = models.DateField()
    schedule_spec = models.ForeignKey(Specialization)
    schedule_sg = models.ManyToMany(StudentGroup)

在schedule_sg中,我希望根据schedule_spec创建多个选择。怎么样?我尝试django-smart-choices,但它不支持ManyToMany feilds。

0 个答案:

没有答案