This is my code. I understand that the User class needs USERNAME_FIELD, but I have that, so I am not sure exactly what the issue is. Any help is greatly appreciated.
# User model
class User(AbstractBaseUser):
# email
email = models.EmailField(
verbose_name='email address',
max_length=255,
unique=True,
)
USERNAME_FIELD = 'email'
REQUIRED_FIELDS = []
# active status
active = models.BooleanField(default=True)
# admin status
admin = models.BooleanField(default=False)
# first name
fname = models.TextField(default="")
# last name
lname = models.TextField(default="")
# what year of graduation
year = models.IntegerField(default = 0)
在 User 模型中添加 username=None 字段。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.