File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
src/country_workspace/versioning/scripts Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change 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 )]
You can’t perform that action at this time.
0 commit comments