generated from ministryofjustice/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathforms.py
110 lines (97 loc) · 3.77 KB
/
forms.py
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
from wtforms import SelectMultipleField
from app.categories.validators import ExclusiveValue
from app.categories.widgets import CategoryCheckboxInput
from app.categories.forms import QuestionForm
from wtforms.validators import InputRequired
from app.categories.x_cat.forms import AreYouUnder18Form
from app.categories.constants import DISCRIMINATION
from flask_babel import lazy_gettext as _
class DiscriminationQuestionForm(QuestionForm):
category = DISCRIMINATION
class DiscriminationWhereForm(DiscriminationQuestionForm):
title = _("Where did the discrimination happen?")
next_step_mapping = {
"*": "categories.discrimination.why",
"notsure": "categories.discrimination.why",
}
question = SelectMultipleField(
title,
widget=CategoryCheckboxInput(
show_divider=True, hint_text=_("You can select more than one.")
),
validators=[
InputRequired(message=_("Select where the discrimination happened"))
],
choices=[
("work", _("Work - including colleagues, employer or employment agency")),
("school", _("School, college, university or other education setting")),
(
"business",
_(
"Businesses or services - such as a shop, restaurant, train, hotel, bank, law firm"
),
),
("healthcare", _("Health or care - such as a hospital or care home")),
("housing", _("Housing - such as a landlord or estate agent")),
(
"public",
_(
"Public services and authorities - such as the police, social services, council or local authority, jobcentre, government"
),
),
("club", _("Clubs and associations - such as a sports club")),
("", ""),
("notsure", _("I’m not sure")),
],
)
class DiscriminationWhyForm(DiscriminationQuestionForm):
title = _("Why were you discriminated against?")
next_step_mapping = {
"*": "categories.discrimination.age",
"none": "categories.discrimination.cannot_find_your_problem",
}
question = SelectMultipleField(
title,
widget=CategoryCheckboxInput(
show_divider=True,
hint_text=_("You can select more than one."),
behaviour="exclusive",
),
validators=[
InputRequired(message=_("Select why you were discriminated against")),
ExclusiveValue(
exclusive_value="none",
message=_(
"Select why you were discriminated against, or select ‘None of these’"
),
),
],
choices=[
("race", _("Race, colour, ethnicity, nationality")),
("sex", _("Sex (male or female)")),
("disability", _("Disability, health condition, mental health condition")),
("religion", _("Religion, belief, lack of religion")),
("age", _("Age")),
("pregnancy", _("Pregnancy or being a mother")),
(
"sexualorientation",
_("Sexual orientation - gay, bisexual, other sexuality"),
),
(
"gender",
_("Gender reassignment, being transgender, non-binary or gender-fluid"),
),
(
"marriage",
_("Married status - being married, in a civil partnership"),
),
("", ""),
("none", _("None of these")),
],
)
class DiscriminationAreYouUnder18Form(AreYouUnder18Form):
category = DISCRIMINATION
next_step_mapping = {
"yes": "contact.contact_us",
"no": "categories.results.in_scope",
}