stages/prompt: Add initial_data prompt field and ability to select a default choice for choice fields (#5095)
* Added initial_value to model * Added initial_value to admin panel * Added initial_value support to flows; updated tests * Updated default blueprints * update docs * Fix test * Fix another test * Fix yet another test * Add placeholder migration * Remove unused import
This commit is contained in:
@ -13,12 +13,14 @@ entries:
|
||||
id: flow
|
||||
- attrs:
|
||||
order: 200
|
||||
placeholder: |
|
||||
placeholder: Username
|
||||
placeholder_expression: false
|
||||
initial_value: |
|
||||
try:
|
||||
return user.username
|
||||
except:
|
||||
return ''
|
||||
placeholder_expression: true
|
||||
initial_value_expression: true
|
||||
required: true
|
||||
type: text
|
||||
field_key: username
|
||||
@ -29,12 +31,14 @@ entries:
|
||||
model: authentik_stages_prompt.prompt
|
||||
- attrs:
|
||||
order: 201
|
||||
placeholder: |
|
||||
placeholder: Name
|
||||
placeholder_expression: false
|
||||
initial_value: |
|
||||
try:
|
||||
return user.name
|
||||
except:
|
||||
return ''
|
||||
placeholder_expression: true
|
||||
initial_value_expression: true
|
||||
required: true
|
||||
type: text
|
||||
field_key: name
|
||||
@ -45,12 +49,14 @@ entries:
|
||||
model: authentik_stages_prompt.prompt
|
||||
- attrs:
|
||||
order: 202
|
||||
placeholder: |
|
||||
placeholder: Email
|
||||
placeholder_expression: false
|
||||
initial_value: |
|
||||
try:
|
||||
return user.email
|
||||
except:
|
||||
return ''
|
||||
placeholder_expression: true
|
||||
initial_value_expression: true
|
||||
required: true
|
||||
type: email
|
||||
field_key: email
|
||||
@ -61,12 +67,14 @@ entries:
|
||||
model: authentik_stages_prompt.prompt
|
||||
- attrs:
|
||||
order: 203
|
||||
placeholder: |
|
||||
placeholder: Locale
|
||||
placeholder_expression: false
|
||||
initial_value: |
|
||||
try:
|
||||
return user.attributes.get("settings", {}).get("locale", "")
|
||||
except:
|
||||
return ''
|
||||
placeholder_expression: true
|
||||
initial_value_expression: true
|
||||
required: true
|
||||
type: ak-locale
|
||||
field_key: attributes.settings.locale
|
||||
|
Reference in New Issue
Block a user