Skip to content

Commit

Permalink
Merge pull request #554 from rcpch/mbarton/create-superuser
Browse files Browse the repository at this point in the history
Fix running Djangos native createsuperuser
  • Loading branch information
mbarton authored Feb 5, 2025
2 parents 961518b + dc65bbf commit 553433a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion project/npda/management/commands/create_npda_superuser.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def handle(self, *args, **kwargs):
if not admin_user_model.objects.filter(email=LOCAL_DEV_ADMIN_EMAIL).exists():
admin_user_model.objects.create_superuser(
first_name="SuperuserAda",
last_name="Lovelace",
surname="Lovelace",
email=LOCAL_DEV_ADMIN_EMAIL,
password=LOCAL_DEV_ADMIN_PASSWORD
)
Expand Down
8 changes: 4 additions & 4 deletions project/npda/models/npda_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def create_user(self, email, password, role, **extra_fields):

return user

def create_superuser(self, first_name, last_name, email, password):
def create_superuser(self, first_name, surname, email, password, is_rcpch_audit_team_member=True, role=RCPCH_AUDIT_TEAM):
"""
Create and save a SuperUser with the given email and password.
"""
Expand All @@ -77,12 +77,12 @@ def create_superuser(self, first_name, last_name, email, password):
email=email.lower(),
password=password,
first_name=first_name,
last_name=last_name,
role=RCPCH_AUDIT_TEAM,
last_name=surname,
role=role,
is_superuser=True,
is_active=True,
is_staff=True,
is_rcpch_audit_team_member=True,
is_rcpch_audit_team_member=is_rcpch_audit_team_member,
is_rcpch_staff=True,
email_confirmed=True,
view_preference=1
Expand Down

0 comments on commit 553433a

Please sign in to comment.