33 lines
760 B
Python
33 lines
760 B
Python
# 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),
|
|
]
|