docs: remove last occurrences to jinja2
This commit is contained in:
@ -21,8 +21,8 @@ A Prompt has the following attributes:
|
||||
|
||||
HTML name used for the prompt. This key is also used to later retrieve the data in expression policies:
|
||||
|
||||
```jinja2
|
||||
{{ request.context.prompt_data.<field_key> }}
|
||||
```python
|
||||
request.context.get('prompt_data').get('<field_key>')
|
||||
```
|
||||
|
||||
### `label`
|
||||
|
@ -4,13 +4,12 @@ Further validation of prompts can be done using policies.
|
||||
|
||||
To validate that two password fields are identical, create the following expression policy:
|
||||
|
||||
```jinja2
|
||||
{% if request.context.prompt_data.password == request.context.prompt_data.password_repeat %}
|
||||
True
|
||||
{% else %}
|
||||
{% do pb_message("Passwords don't match.") %}
|
||||
False
|
||||
{% endif %}
|
||||
```python
|
||||
if request.context.get('prompt_data').get('password') == request.context.get('prompt_data').get('password_repeat'):
|
||||
return True
|
||||
|
||||
pb_message("Passwords don't match.")
|
||||
return False
|
||||
```
|
||||
This policy expects you two have two password fields with `field_key` set to `password` and `password_repeat`.
|
||||
|
||||
|
@ -1,5 +1,8 @@
|
||||
# Expression Policies
|
||||
|
||||
!!! notice
|
||||
These variables are available in addition to the common variables/functions defined in [**Expressions**](../expressions/index.md)
|
||||
|
||||
The passing of the policy is determined by the return value of the code. Use `return True` to pass a policy and `return False` to fail it.
|
||||
|
||||
### Available Functions
|
||||
|
@ -2,6 +2,9 @@
|
||||
|
||||
The property mapping should return a value that is expected by the Provider/Source. What types are supported, is documented in the individual Provider/Source. Returning `None` is always accepted, this simply skips this mapping.
|
||||
|
||||
!!! notice
|
||||
These variables are available in addition to the common variables/functions defined in [**Expressions**](../expressions/index.md)
|
||||
|
||||
### Context Variables
|
||||
|
||||
- `user`: The current user, this might be `None` if there is no contextual user. ([ref](../expressions/reference/user-object.md))
|
||||
|
Reference in New Issue
Block a user