class weeks(models.Model):
#星期信息
stu = models.ForeignKey(students,on_delete=models.CASCADE)
weeklist = ((1,'星期一'),(2,'星期二'),(3,'星期三'),(4,'星期四'),(5,'星期五'),(6,'星期六'),(7,'星期日'))
week = models.PositiveSmallIntegerField(choices=weeklist,)
#上课时间
schooltime = models.TimeField(null=True,blank=True,verbose_name='上课时间')
def __str__(self):
return '%s %s %s'%(self.stu.name,self.get_week_display(),self.schooltime)
class Meta:
verbose_name = '星期 上课时间'
ordering=['stu','week']
链接: