Skip to content

Commit 85f7a09

Browse files
author
Niels Verbeek
committed
feat(copy): adds documentation for datasource on_copy
1 parent 0c0d69e commit 85f7a09

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

forms/data-sources.md

+8
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ For the label, it's possible to use a dict with translated values.
3737

3838
Note: If the labels returned from`get_data()` depend on the current user's language, you need to return a `dict` with the language code as keys instead of translating the value yourself. Returning already translated values is not supported, as it would break caching and validation.
3939

40+
### `on_copy`-method
41+
42+
When a an answer of type TYPE_DYNAMIC_CHOICE or TYPE_DYNAMIC_MULTIPLE_CHOICE gets copied the meaning of the slug and label of the dynamic option could potentially be changed when the datasource it's data changes. During the answer copy process the linked datasource it's on_copy method will be called to decide the desired result.
43+
44+
- return the same slug,label tuple to not perform any change (default behavior)
45+
- return an altered slug or(/and) label to change the answer value
46+
- return a None value for the slug, to discard the answer value
47+
4048
#### Arguments
4149

4250
* `user`: The OIDC user object for the request

0 commit comments

Comments
 (0)