项目目录
1、在apps/users目录中的models.py中导入Django自带的User模型,并在此基础上UserProfile模型对其扩展
# models.py
from django.db import models
from django.contrib.auth.models import AbstractUser # 导入Django自带的User模块
# 模型字段(field)
# https://docs.djangoproject.com/zh-hans/3.0/ref/models/fields/#django.db.models.DateField
GENDER_CHOICES = [
("male", "男"),
("female", "女"),
]
class UserProfile(AbstractUser):
nick_name = models.CharField(verbose_name="昵称", max_length=50, default="") # 默认为空
# null is purely database-related, whereas blank is validation-related.
# If a field has blank=True, form validation will allow entry of an empty value.
# If a field has blank=False, the fie