这是我的模型.py
class SubjectsEnrolled(models.Model):
student = models.ForeignKey(Student)
STATUS = (
('1', 'Passed'),
('2', 'Failed'),
('3', 'No Grade'),
('4', 'Incomplete'),
)
subject = models.ForeignKey(Subject)
grade = models.CharField(max_length=100, blank=True, null=True)
status = models.CharField(max_length=2, choices=STATUS, blank=True, null=True)
schoolterm = models.ForeignKey(SchoolTerm)
class Meta:
verbose_name = _('Subjects Enrolled')
verbose_name_plural = _('Subjects Enrolled')
这是我的 Admin.py
class SubjectsEnrolled(models.Model):
student = models.ForeignKey(Student)
STATUS = (
('1', 'Passed'),
('2', 'Failed'),
('3', 'No Grade'),
('4', 'Incomplete'),
)
subject = models.ForeignKey(Subject)
grade = models.CharField(max_length=100, blank=True, null=True)
status = models.CharField(max_length=2, choices=STATUS, blank=True, null=True)
schoolterm = models.ForeignKey(SchoolTerm)
class Meta:
verbose_name = _('Subjects Enrolled')
verbose_name_plural = _('Subjects Enrolled')
学生在一个学期中应该有一个科目,并且该科目在一个学期中不应重复。