forked from jhpyle/docassemble
-
Notifications
You must be signed in to change notification settings - Fork 1
/
postpopulate-list.yml
61 lines (61 loc) · 1.35 KB
/
postpopulate-list.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
metadata:
title: Postpopulate lists
documentation: "https://docassemble.org/docs/groups.html#postpopulate"
example start: 1
example end: 9
---
objects:
- user: Individual
- user.mom: Individual
- user.favorite_things: |
DAList.using(object_type=Thing)
---
code: |
if user.likes_something:
user.favorite_things.there_are_any = True
else:
default_things_appended
user.favorite_things.there_are_any = False
user.favorite_things.there_is_another = False
---
code: |
if user.likes_another_thing:
del user.likes_another_thing
user.favorite_things.there_is_another = True
else:
default_things_appended
user.favorite_things.there_is_another = False
---
code: |
user.favorite_things.append(user.mom)
user.favorite_things.appendObject(
name='apple pie'
)
default_things_appended = True
---
question: |
What is your mother's name?
fields:
- First name: user.mom.name.first
- Last name: user.mom.name.last
---
question: |
What is your ${ ordinal(i) }
favorite thing?
fields:
- Thing: user.favorite_things[i].name.text
---
question: |
Do you have any favorite things?
yesno: user.likes_something
---
question: |
Besides ${ user.favorite_things },
do you have any other favorite
things?
yesno: user.likes_another_thing
---
mandatory: True
question: |
Your favorite things are
${ user.favorite_things }.