core: fix error when migrating with AK_ADMIN_TOKEN set

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-08-11 22:36:52 +02:00
parent 38292a588b
commit c6dddc97f0

View file

@ -8,9 +8,7 @@ from django.db.backends.base.schema import BaseDatabaseSchemaEditor
def create_default_user_token(apps: Apps, schema_editor: BaseDatabaseSchemaEditor):
# We have to use a direct import here, otherwise we get an object manager error
from authentik.core.models import TokenIntents, User
Token = apps.get_model("authentik_core", "token")
from authentik.core.models import Token, TokenIntents, User
db_alias = schema_editor.connection.alias