0
的價值,我有三個型號那樣:限制形式的一個字段根據另一場
class SchoolClass(models.Model):
school = models.ForeignKey(School)
class_name = models.CharField(max_length=5)
class School(models.Model):
name = models.CharField(max_length=100)
address = models.TextField(blank=True)
class Student(models.Model):
school = models.OneToOneField(School, null=True)
class_id = models.ForeignKey(SchoolClass)
user = models.OneToOneField(User, on_delete=models.CASCADE)
創建Django表單的學生,有沒有什麼辦法來設置表格只顯示這是在類我選擇的學校?