Remove deprecated display_name field from user registration methods

This commit is contained in:
Kumi 2021-04-14 11:01:38 +02:00
parent 4227f86ffc
commit 3313a47c72

View file

@ -12,8 +12,8 @@ from .helpers import profile_to_coords, upload_path
class UserManager(BaseUserManager):
use_in_migrations = True
def _create_user(self, email, display_name, password, **extra_fields):
values = [email, display_name]
def _create_user(self, email, password, **extra_fields):
values = [email]
field_value_map = dict(zip(self.model.REQUIRED_FIELDS, values))
for field_name, value in field_value_map.items():
if not value:
@ -29,12 +29,12 @@ class UserManager(BaseUserManager):
user.save(using=self._db)
return user
def create_user(self, email, display_name, password=None, **extra_fields):
return self._create_user(email, display_name, password, **extra_fields)
def create_user(self, email, password=None, **extra_fields):
return self._create_user(email, password, **extra_fields)
def create_superuser(self, email, display_name, password=None, **extra_fields):
def create_superuser(self, email, password=None, **extra_fields):
extra_fields.setdefault('is_superuser', True)
return self._create_user(email, display_name, password, **extra_fields)
return self._create_user(email, password, **extra_fields)
class User(AbstractBaseUser):
email = models.EmailField(unique=True)