Skip to content

Commit 7820e46

Browse files
Merge pull request #103 from unicef/feature/247967-consent-and-consent-sharing
AB#247967: consent and consent sharing
2 parents 9531b1b + 10da05c commit 7820e46

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
from django import forms
2+
3+
from hope_flex_fields.models import Fieldset, FieldDefinition, FlexField
4+
from packaging.version import Version
5+
6+
from country_workspace.contrib.hope.constants import HOUSEHOLD_CHECKER_NAME
7+
8+
_script_for_version = Version("0.1.0")
9+
10+
CONSENT_SHARING = "consent_sharing"
11+
12+
13+
def forward() -> None:
14+
household_fieldset = Fieldset.objects.get(name=HOUSEHOLD_CHECKER_NAME)
15+
household_fieldset.fields.create(
16+
name=CONSENT_SHARING,
17+
definition=FieldDefinition.objects.get(field_type=forms.CharField),
18+
attrs={},
19+
)
20+
21+
22+
def backward() -> None:
23+
FlexField.objects.get(name=CONSENT_SHARING).delete()
24+
25+
26+
class Scripts:
27+
requires = []
28+
operations = [(forward, backward)]

0 commit comments

Comments
 (0)