flows: fix migration removing flow titles

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-12-30 21:00:00 +01:00
parent e5d9c6537c
commit fc19372709
1 changed files with 3 additions and 4 deletions

View File

@ -12,10 +12,9 @@ def update_title_for_defaults(apps: Apps, schema_editor: BaseDatabaseSchemaEdito
db_alias = schema_editor.connection.alias db_alias = schema_editor.connection.alias
Flow = apps.get_model("authentik_flows", "Flow") Flow = apps.get_model("authentik_flows", "Flow")
for flow in Flow.objects.using(db_alias).all(): for flow in Flow.objects.using(db_alias).all():
if flow.slug in slug_title_map: if flow.slug not in slug_title_map:
continue
flow.title = slug_title_map[flow.slug] flow.title = slug_title_map[flow.slug]
else:
flow.title = flow.name
flow.save() flow.save()