Skip to content

Commit

Permalink
Set superuser for CLI created users
Browse files Browse the repository at this point in the history
Closes #543
  • Loading branch information
cdubz committed Oct 15, 2022
1 parent 2cef819 commit de4d66c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions babybuddy/forms.py
Expand Up @@ -20,6 +20,7 @@ class Meta:

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()
Expand Down
2 changes: 2 additions & 0 deletions babybuddy/management/commands/createuser.py
Expand Up @@ -113,6 +113,8 @@ def handle(self, *args, **options):
).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:
Expand Down

0 comments on commit de4d66c

Please sign in to comment.