This commit is contained in:
2026-03-26 15:39:31 +03:30
parent f305e00cfe
commit 32a0e3f3d9
26 changed files with 2188 additions and 265 deletions
+1
View File
@@ -0,0 +1 @@
@@ -0,0 +1,21 @@
from django.core.management.base import BaseCommand, CommandError
from account.seeds import ADMIN_USER_DATA, seed_admin_user
class Command(BaseCommand):
help = "Create or update the default admin user."
def handle(self, *args, **options):
try:
user, created = seed_admin_user()
except ValueError as exc:
raise CommandError(str(exc)) from exc
action = "created" if created else "updated"
self.stdout.write(
self.style.SUCCESS(
f"Admin user {action}: username={user.username}, email={user.email}, "
f"phone_number={user.phone_number}, password={ADMIN_USER_DATA['password']}"
)
)