使用默认User表.默认显示用户username,转换成get_full_name()
/home/labsmith/venv_labsmit/lib/python3.6/site-packages/django/contrib/auth/models.py
class User(AbstractUser):
"""
Users within the Django authentication system are represented by this
model.
Username and password are required. Other fields are optional.
"""
def __str__(self):
return self.get_full_name()
class Meta(AbstractUser.Meta):
swappable = 'AUTH_USER_MODEL'
添加 str 方法
暂时没发现异常,有异常在更新