cook: allow setting first and last names of superusers (#21889)
This commit is contained in:
parent
c1768632e1
commit
cc724cfc87
|
@ -137,10 +137,13 @@ class Command(BaseCommand):
|
|||
|
||||
connection.set_tenant(tenant)
|
||||
|
||||
def create_superuser(self, username='admin', email='admin@localhost', password=None):
|
||||
def create_superuser(self, username='admin', email='admin@localhost',
|
||||
first_name='Admin', last_name='', password=None):
|
||||
user, created = User.objects.get_or_create(
|
||||
username=username, email=email, is_superuser=True)
|
||||
if created:
|
||||
user.first_name = first_name
|
||||
user.last_name = last_name
|
||||
password = password or User.objects.make_random_password(length=30)
|
||||
if password:
|
||||
user.set_password(password)
|
||||
|
|
Loading…
Reference in New Issue