stages/prompt: fallback to uuid for unique names

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Jens Langhammer 2023-01-25 23:29:26 +01:00
parent 5ea9595c9c
commit 5631a99f00
No known key found for this signature in database
1 changed files with 3 additions and 0 deletions

View File

@ -1,4 +1,5 @@
# Generated by Django 4.1.5 on 2023-01-23 19:42
from uuid import uuid4
from django.apps.registry import Apps
from django.db import migrations, models
@ -14,6 +15,8 @@ def set_generated_name(apps: Apps, schema_editor: BaseDatabaseSchemaEditor):
stage = prompt.promptstage_set.order_by("name").first()
if stage:
name += "_" + stage.name
else:
name += "_" + uuid4()
prompt.name = name
prompt.save()