🚀 first commit
This commit is contained in:
32
src/users/migrations/0002_add_superuser.py
Normal file
32
src/users/migrations/0002_add_superuser.py
Normal file
@@ -0,0 +1,32 @@
|
||||
# Generated by Django 4.0.5 on 2022-10-04 19:19
|
||||
from django.conf import settings
|
||||
from django.db import migrations
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def create_default_superuser(apps, schema_editor):
|
||||
User = apps.get_model("users", "User")
|
||||
|
||||
try:
|
||||
new_superuser = User.objects.create_superuser(
|
||||
uid="50ca4e0b-8f5a-48af-a63c-426b3adce3d0",
|
||||
username="admin@admin.cz",
|
||||
password="Heslo1234",
|
||||
email="admin@admin.cz")
|
||||
|
||||
new_superuser.save()
|
||||
except Exception as e:
|
||||
logger.error(e)
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('users', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(create_default_superuser),
|
||||
]
|
||||
Reference in New Issue
Block a user