setting admin user

This commit is contained in:
Flatlogic Bot 2026-02-09 17:33:09 +00:00
parent 9e26d44a3c
commit 843c1807e7

View File

@ -0,0 +1,19 @@
from django.db import migrations
from django.contrib.auth.models import User
def create_superuser(apps, schema_editor):
if not User.objects.filter(username='admin').exists():
User.objects.create_superuser('admin', 'admin@example.com', 'admin12345')
def remove_superuser(apps, schema_editor):
User.objects.filter(username='admin').delete()
class Migration(migrations.Migration):
dependencies = [
('core', '0030_salepayment_created_at_purchasepayment_created_at'),
]
operations = [
migrations.RunPython(create_superuser, remove_superuser),
]