0
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.

m tam
  • 3
  • 2
  • Your username which is named as USERNAME_FIELD is not unique. You should add unique=True to make this field unique – PTomasz Jul 22 '22 at 06:50

1 Answers1

0

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)