Autologin
Some checks are pending
Docker hub build / docker (push) Waiting to run

This commit is contained in:
A B
2024-10-28 00:06:35 +00:00
parent b6ad6e8578
commit 7cf99af20d
5 changed files with 33 additions and 18 deletions

View File

@ -0,0 +1,17 @@
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'))