c3lf-system-3/core/authentication/migrations/0004_legacy_user.py

19 lines
613 B
Python
Raw Permalink Normal View History

2024-01-07 16:45:42 +00:00
from django.conf import settings
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('authentication', '0003_groups'),
]
def create_legacy_user(apps, schema_editor):
2024-06-22 23:33:24 +00:00
ExtendedUser = apps.get_model('authentication', 'ExtendedUser')
2024-01-07 16:45:42 +00:00
ExtendedUser.objects.create_user(settings.LEGACY_USER_NAME, 'mail@' + settings.MAIL_DOMAIN,
settings.LEGACY_USER_PASSWORD)
operations = [
migrations.RunPython(create_legacy_user)
]