mirror of
https://github.com/house-of-vanity/OutFleet.git
synced 2025-07-06 17:14:07 +00:00
18 lines
632 B
Python
18 lines
632 B
Python
|
from django.core.management.base import BaseCommand
|
||
|
from django.contrib.auth import get_user_model
|
||
|
|
||
|
class Command(BaseCommand):
|
||
|
help = 'Create default admin user'
|
||
|
|
||
|
def handle(self, *args, **kwargs):
|
||
|
User = get_user_model()
|
||
|
if not User.objects.filter(username='admin').exists():
|
||
|
User.objects.create_superuser(
|
||
|
username='admin',
|
||
|
password='admin',
|
||
|
email='admin@localhost'
|
||
|
)
|
||
|
self.stdout.write(self.style.SUCCESS('Admin user created'))
|
||
|
else:
|
||
|
self.stdout.write(self.style.WARNING('Admin user already exists'))
|