﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
35287	manage createsuperuser too restrictive	Matthew Pava	nobody	"I have a custom user model inheriting from `AbstractUser`. I set `username = None` because I don't care about usernames. I care about emails. Anyway, whenever I do that, I get an error message from the `manage createsuperuser` command.

For example:

{{{
TypeError: UserManager.create_superuser() missing 1 required positional argument: 'username'
ValueError: The given username must be set
TypeError: StudentManager._create_user() takes from 1 to 3 positional arguments but 4 were given
}}}



This has forced me to customize the `UserManager`:

{{{
class MyUserManager(UserManager):
    def _create_user(self, username=None, email=None, password=None, **extra_fields):
        email = self.normalize_email(email)
        user = self.model(email=email, **extra_fields)
        user.password = make_password(password)
        user.save(using=self._db)
        return user

    def create_superuser(self, email=None, password=None, **extra_fields):
        super().create_superuser(email, password, **extra_fields)
}}}

My rationale for not having or requiring a username is that all valid email addresses are unique. I think the `createsuperuser` command ought to be more lenient in regard to the `username` field."	Bug	closed	Core (Management commands)	5.0	Normal	duplicate	createsuperuser username		Unreviewed	0	0	0	0	0	0
