Skip to content

Commit

Permalink
Add sexuality question
Browse files Browse the repository at this point in the history
  • Loading branch information
SamLR committed Jun 4, 2024
1 parent 5230f99 commit afc1c64
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
9 changes: 6 additions & 3 deletions apps/common/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ class Meta(FlaskForm.Meta):
AGE_VALUES = ("0-15", "16-25", "26-35", "36-45", "46-55", "56-65", "66+")
AGE_CHOICES = tuple(OPT_OUT + [(v, v) for v in AGE_VALUES])

SEXUALITY_CHOICES = ("0-15", "16-25", "26-35", "36-45", "46-55", "56-65", "66+")
SEXUALITY_CHOICES = tuple(OPT_OUT + [(v, v) for v in AGE_VALUES])
SEXUALITY_VALUES = ("straight-or-heterosexual","gay-or-lesbian","bisexual","other")
SEXUALITY_CHOICES = tuple(OPT_OUT + [(v, v.capitalize().replace("-", " ")) for v in SEXUALITY_VALUES])


DISABILITY_CHOICES = tuple(
Expand All @@ -56,7 +56,7 @@ class Meta(FlaskForm.Meta):
("dyslexic", "Dyslexia, dyspraxia or attention deficit hyperactivity disorder (ADHD) or another learning disability"),
("long-term-illness", "Long-term illness (for example cancer, HIV, diabetes, chronic heart disease or epilepsy)"),
("mental-health-illness", "Mental health condition (for example depression, schizophrenia or anxiety disorder)"),
("physical-disabled", "Physical disability or mobility issue (for example impaired use of arms or legs, use of a wheelchair or cruches)"),
("physical-disabled", "Physical disability or mobility issue (for example impaired use of arms or legs, use of a wheelchair or crutches)"),
("other", "Another disability, health condition or impairment affecting daily life"),
]
)
Expand Down Expand Up @@ -120,6 +120,7 @@ class DiversityForm(Form):
age = SelectField("Age", default=OPT_OUT[0], choices=AGE_CHOICES)
gender = SelectField("Gender", default=OPT_OUT[0], choices=GENDER_CHOICES)
ethnicity = SelectField("Ethnicity", default=OPT_OUT[0], choices=ETHNICITY_CHOICES)
sexuality = SelectField("Sexuality", default=OPT_OUT[0], choices=SEXUALITY_CHOICES)
disability = MultiCheckboxField("Disability", choices=DISABILITY_CHOICES)

# Track CfP reviewer tags
Expand All @@ -144,6 +145,7 @@ def update_user(self, user):
user.diversity.age = self.age.data
user.diversity.gender = self.gender.data
user.diversity.ethnicity = self.ethnicity.data
user.diversity.sexuality = self.sexuality.data
user.diversity.disability = self.disability.data

if self.cfp_tags_required:
Expand All @@ -160,6 +162,7 @@ def set_from_user(self, user):
self.age.data = guess_age(user.diversity.age)
self.gender.data = guess_gender(user.diversity.gender)
self.ethnicity.data = guess_ethnicity(user.diversity.ethnicity)
self.sexuality.data = user.diversity.sexuality
self.disability.data = user.diversity.disability

if self.cfp_tags_required and user.cfp_reviewer_tags:
Expand Down
1 change: 1 addition & 0 deletions templates/_diversityform.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
{{ render_field(form.age, True) }}
{{ render_field(form.gender, True) }}
{{ render_field(form.ethnicity, True) }}
{{ render_field(form.sexuality, True) }}
{{ render_multi_checkbox(form.disability) }}
{% if current_user.has_permission("cfp_reviewer") %}
<p>
Expand Down

0 comments on commit afc1c64

Please sign in to comment.