a user with a nonunique username this model is not invalid if it is used with a custom authentication backend which supports nonunique usernames a user with a non unique username this model is not invalid if it is used with a custom authentication backend which supports non unique usernames
from django.contrib.auth.models import AbstractBaseUser, UserManager
from django.db import models


class CustomUserNonUniqueUsername(AbstractBaseUser):
    

    username = models.CharField(max_length=30)
    email = models.EmailField(blank=True)
    is_staff = models.BooleanField(default=False)
    is_superuser = models.BooleanField(default=False)

    USERNAME_FIELD = "username"
    REQUIRED_FIELDS = ["email"]

    objects = UserManager()