First commit of claude's rework in django + vanillajs fronted
This commit is contained in:
0
apps/users/management/commands/__init__.py
Normal file
0
apps/users/management/commands/__init__.py
Normal file
21
apps/users/management/commands/create_default_admin.py
Normal file
21
apps/users/management/commands/create_default_admin.py
Normal file
@@ -0,0 +1,21 @@
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = 'Create a default superuser for development (idempotent).'
|
||||
|
||||
def handle(self, *args, **options):
|
||||
User = get_user_model()
|
||||
email = 'admin@shooterhub.local'
|
||||
if User.objects.filter(email=email).exists():
|
||||
self.stdout.write(f'Admin already exists: {email}')
|
||||
return
|
||||
User.objects.create_superuser(
|
||||
username='admin',
|
||||
email=email,
|
||||
password='changeme',
|
||||
)
|
||||
self.stdout.write(self.style.SUCCESS(
|
||||
f'Superuser created — email: {email} password: changeme'
|
||||
))
|
||||
Reference in New Issue
Block a user