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): ExtendedUser = apps.get_model('authentication', 'ExtendedUser') ExtendedUser.objects.create_user(settings.LEGACY_USER_NAME, 'mail@' + settings.MAIL_DOMAIN, settings.LEGACY_USER_PASSWORD) operations = [ migrations.RunPython(create_legacy_user) ]