Set superuser for CLI created users

Closes #543
This commit is contained in:
Christopher C. Wells 2022-10-15 14:02:55 -07:00
parent 2cef8199fc
commit de4d66cecd
2 changed files with 3 additions and 0 deletions

View File

@ -20,6 +20,7 @@ class UserAddForm(UserCreationForm):
def save(self, commit=True):
user = super(UserAddForm, self).save(commit=False)
# All Baby Buddy users are superusers.
user.is_superuser = True
if commit:
user.save()

View File

@ -113,6 +113,8 @@ class Command(BaseCommand):
).create_user(**user_data, password=user_password)
user.email = options.get("email")
user.is_staff = options.get("is_staff")
# All Baby Buddy users are superusers.
user.is_superuser = True
user.save()
if options.get("verbosity") > 0: