Issue
Model.py
class User(AbstractUser):
username = models.CharField(max_length=20)
Why does the phrase below appear in cmd?
WARNINGS: ourtube.User: (auth.W004) 'User.username' is named as the 'USERNAME_FIELD', but it is not unique. HINT: Ensure that your authentication backend(s) can handle non-unique usernames.
Solution
This is because you are not mentioning the unique=True in username fields.
username = models.CharField(max_length=20)
change to
username = models.CharField(max_length=20, unique=True)
Answered By - Nabeel Hussain
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.