setting admin user
This commit is contained in:
parent
9e26d44a3c
commit
843c1807e7
19
core/migrations/0031_create_superuser.py
Normal file
19
core/migrations/0031_create_superuser.py
Normal 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),
|
||||||
|
]
|
||||||
Loading…
x
Reference in New Issue
Block a user