From 9f0c74664d8f90dacd40db3e30ccafc422272e2d Mon Sep 17 00:00:00 2001 From: JensDiemer Date: Tue, 29 Dec 2020 11:59:31 +0100 Subject: [PATCH] Make "--email" optional in "create_superuser" manage command --- django_ynh/management/commands/create_superuser.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/django_ynh/management/commands/create_superuser.py b/django_ynh/management/commands/create_superuser.py index f69c2ba..263d45f 100644 --- a/django_ynh/management/commands/create_superuser.py +++ b/django_ynh/management/commands/create_superuser.py @@ -26,7 +26,7 @@ class Command(BaseCommand): parser.add_argument( "--email", action="store", - required=True, + default=None, ) def handle(self, *args, **options): @@ -40,7 +40,8 @@ class Command(BaseCommand): user.is_active = True user.is_staff = True user.is_superuser = True - user.email = email + if email: + user.email = email else: print(f'Create new super user "{username}"', file=sys.stderr) user = User.objects.create_superuser(username=username, email=email, password=None)