我正在尝试为公司一周的工作时间建模。这是我的尝试:
class Company(models.Model):
name = models.CharField(max_length=100)
logo = models.FileField(upload_to='company_logos')
mon_start = models.TimeField()
mon_end = models.TimeField()
tue_start = models.TimeField()
tue_end = models.TimeField()
wed_start = models.TimeField()
wed_end = models.TimeField()
thu_start = models.TimeField()
thu_end = models.TimeField()
fri_start = models.TimeField()
fri_end = models.TimeField()
sat_start = models.TimeField()
sat_end = models.TimeField()
sun_start = models.TimeField(blank=True)
sun_end = models.TimeField(blank=True)
这看起来正确吗?
没有更动态的方式来定义它吗?
我可以轻松地验证每一天(在表格上)吗?