(self, username)
Check if the username is already in use

        Until there is a case-insensitive constraint on usernames, it is
        necessary to check for existing usernames manually. This is not a
        perfect solution, but the chance that two people sign up with the same
        username at the same time is low enough.
Check if the username is already in use
Check if the username is already in use
def _check_username(self, username):
        """Check if the username is already in use

        Until there is a case-insensitive constraint on usernames, it is
        necessary to check for existing usernames manually. This is not a
        perfect solution, but the chance that two people sign up with the same
        username at the same time is low enough."""
        UserModel = get_user_model()
        users = UserModel.objects.filter(username__iexact=username)
        if users.exists():
            raise DuplicateUsername(username)
def _check_username ( self , username ) : UserModel = get_user_model ( ) users = UserModel . objects . filter ( username__iexact = username ) if users . exists ( ) : raise DuplicateUsername ( username )