stages/prompt: fallback to uuid for unique names
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
parent
5ea9595c9c
commit
5631a99f00
|
@ -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()
|
||||
|
||||
|
|
Reference in New Issue