# TODO: 员工表
class Employee(models.Model):
id = models.AutoField(primary_key=True)
birth = models.DateField("生日", blank=True, null=True)
flag_choice = (
("1", "阳历"),
("2", "农历"),
)
birth_flag = models.CharField("阳/农历", max_length=1, choices=flag_choice, default="1")
def show_birth(self):
if self.birth:
return self.birth.strftime('%m月%d日')
else:
return '空'
show_birth.short_description = u'生日'
show_birth.admin_order_field = "birth" # 根据生日排序