from django.contrib.auth.models import AbstractUser # 引入user模型的基础类
class User(AbstractUser):
cn_name = models.CharField(u'中文名', max_length=30, blank=True)
department = models.ForeignKey(Department, related_name="department_user", verbose_name='所属部门',
on_delete=models.PROTECT)
dingtalk_id = models.CharField('钉钉ID', max_length=30)
mobile = models.CharField('电话', null=True,blank=True,max_length=15)
upuid = models.ForeignKey('self',verbose_name="上级主管", null=True,blank=True,on_delete=models.SET_NULL)
class Meta(AbstractUser.Meta):
swappable = 'AUTH_USER_MODEL'