diff --git a/features/ethnicity.feature b/features/ethnicity.feature index 264acb04..3ef895b9 100644 --- a/features/ethnicity.feature +++ b/features/ethnicity.feature @@ -19,7 +19,7 @@ Feature: Ethnicity page Given I am logged in And I have answered questions showing I am eligible When I go to "/ethnicity" - Then I see a back link to "/gender" + Then I see a back link to "/sex-at-birth" When I fill in and submit my ethnicity with "White" Then I am on "/education" diff --git a/features/gender.feature b/features/gender.feature index f61fcda2..edbb4952 100644 --- a/features/gender.feature +++ b/features/gender.feature @@ -19,9 +19,9 @@ Feature: Gender page Given I am logged in And I have answered questions showing I am eligible When I go to "/gender" - Then I see a back link to "/sex-at-birth" + Then I see a back link to "/weight" When I fill in and submit my gender with "Female" - Then I am on "/ethnicity" + Then I am on "/sex-at-birth" Scenario: Checking responses and changing them Given I am logged in diff --git a/features/questionnaire.feature b/features/questionnaire.feature index fb9d97de..e427e9c0 100644 --- a/features/questionnaire.feature +++ b/features/questionnaire.feature @@ -37,12 +37,12 @@ Feature: Questionnaire When I click "Switch to stone and pounds" And I fill in and submit my weight with "5" stone and "10" pounds - Then I am on "/sex-at-birth" - When I fill in and submit my sex at birth with "Male" - Then I am on "/gender" When I fill in and submit my gender with "Female" + Then I am on "/sex-at-birth" + When I fill in and submit my sex at birth with "Male" + Then I am on "/ethnicity" When I fill in and submit my ethnicity with "White" diff --git a/features/sex_at_birth.feature b/features/sex_at_birth.feature index 70ff10fa..0b4d2ef0 100644 --- a/features/sex_at_birth.feature +++ b/features/sex_at_birth.feature @@ -19,9 +19,9 @@ Feature: Sex at birth page Given I am logged in And I have answered questions showing I am eligible When I go to "/sex-at-birth" - Then I see a back link to "/weight" + Then I see a back link to "/gender" When I fill in and submit my sex at birth with "Male" - Then I am on "/gender" + Then I am on "/ethnicity" Scenario: Checking responses and changing them Given I am logged in diff --git a/features/weight.feature b/features/weight.feature index c826f588..939c47f8 100644 --- a/features/weight.feature +++ b/features/weight.feature @@ -50,11 +50,11 @@ Feature: Weight page When I go to "/weight" Then I see a back link to "/height" When I fill in and submit my weight with "70" - Then I am on "/sex-at-birth" + Then I am on "/gender" When I click "Back" And I click "Switch to stone and pounds" When I fill in and submit my weight with "5" stone and "10" pounds - Then I am on "/sex-at-birth" + Then I am on "/gender" When I click "Back" Then I am on "/weight" diff --git a/lung_cancer_screening/questions/forms/gender_form.py b/lung_cancer_screening/questions/forms/gender_form.py index db1ddf87..1d42a27d 100644 --- a/lung_cancer_screening/questions/forms/gender_form.py +++ b/lung_cancer_screening/questions/forms/gender_form.py @@ -13,17 +13,18 @@ def __init__(self, *args, **kwargs): choices=GenderValues.choices, widget=forms.RadioSelect, label="Which of these best describes you?", - label_classes="nhsuk-fieldset__legend--l", - label_is_page_heading=True, - hint=( - "This information is used to find your NHS number and " - "match with your GP record." - ), error_messages={ 'required': 'Select the option that best describes your gender' } ) + # Add divider before "PREFER_NOT_TO_SAY" + fields = self["value"] + fields.add_divider_after( + GenderValues.NON_BINARY, + "or" + ) + class Meta: model = GenderResponse fields = ['value'] diff --git a/lung_cancer_screening/questions/jinja2/gender.jinja b/lung_cancer_screening/questions/jinja2/gender.jinja new file mode 100644 index 00000000..94e40ac7 --- /dev/null +++ b/lung_cancer_screening/questions/jinja2/gender.jinja @@ -0,0 +1,9 @@ +{% extends 'question_form.jinja' %} + +{% block prelude %} +

Your gender identity

+ +

The answers you submit will not be shared with your patient care advisor during your phone appointment, or with your GP.

+ +

In the future we plan to use information about someone's gender identity to help us plan their care in the NHS lung cancer screening programme.

+{% endblock prelude %} diff --git a/lung_cancer_screening/questions/migrations/0008_alter_genderresponse_value.py b/lung_cancer_screening/questions/migrations/0008_alter_genderresponse_value.py new file mode 100644 index 00000000..bb616377 --- /dev/null +++ b/lung_cancer_screening/questions/migrations/0008_alter_genderresponse_value.py @@ -0,0 +1,18 @@ +# Generated by Django 6.0.3 on 2026-03-19 15:11 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('questions', '0007_termsofuseresponse'), + ] + + operations = [ + migrations.AlterField( + model_name='genderresponse', + name='value', + field=models.CharField(choices=[('F', 'Female'), ('M', 'Male'), ('N', 'Non-binary'), ('P', 'Prefer not to say')], max_length=1), + ), + ] diff --git a/lung_cancer_screening/questions/models/gender_response.py b/lung_cancer_screening/questions/models/gender_response.py index e7838e8b..ec109455 100644 --- a/lung_cancer_screening/questions/models/gender_response.py +++ b/lung_cancer_screening/questions/models/gender_response.py @@ -9,7 +9,6 @@ class GenderValues(models.TextChoices): MALE = "M", 'Male' NON_BINARY = "N", 'Non-binary' PREFER_NOT_TO_SAY = "P", 'Prefer not to say' - GP = "G", 'How I describe myself may not match my GP record' class GenderResponse(BaseModel): diff --git a/lung_cancer_screening/questions/models/sex_at_birth_response.py b/lung_cancer_screening/questions/models/sex_at_birth_response.py index 46911306..dddeed1a 100644 --- a/lung_cancer_screening/questions/models/sex_at_birth_response.py +++ b/lung_cancer_screening/questions/models/sex_at_birth_response.py @@ -7,7 +7,6 @@ class SexAtBirthValues(models.TextChoices): FEMALE = "F", 'Female' MALE = "M", 'Male' - INTERSEX = "I", 'Intersex' class SexAtBirthResponse(BaseModel): diff --git a/lung_cancer_screening/questions/tests/unit/views/test_gender.py b/lung_cancer_screening/questions/tests/unit/views/test_gender.py index 73821272..335bd2de 100644 --- a/lung_cancer_screening/questions/tests/unit/views/test_gender.py +++ b/lung_cancer_screening/questions/tests/unit/views/test_gender.py @@ -107,7 +107,7 @@ def test_creates_a_gender_response(self): response_set.gender_response.value, self.valid_params["value"] ) - def test_redirects_to_ethnicity(self): + def test_redirects_to_sex_at_birth(self): ResponseSetFactory.create(user=self.user, eligible=True) response = self.client.post( @@ -115,7 +115,7 @@ def test_redirects_to_ethnicity(self): self.valid_params ) - self.assertRedirects(response, reverse("questions:ethnicity")) + self.assertRedirects(response, reverse("questions:sex_at_birth")) def test_redirects_to_responses_if_change_query_param_is_true(self): ResponseSetFactory.create(user=self.user, eligible=True) diff --git a/lung_cancer_screening/questions/tests/unit/views/test_sex_at_birth.py b/lung_cancer_screening/questions/tests/unit/views/test_sex_at_birth.py index f5fff9a3..5b3513e3 100644 --- a/lung_cancer_screening/questions/tests/unit/views/test_sex_at_birth.py +++ b/lung_cancer_screening/questions/tests/unit/views/test_sex_at_birth.py @@ -107,7 +107,7 @@ def test_creates_a_sex_at_birth_response(self): response_set.sex_at_birth_response.value, self.valid_params["value"] ) - def test_redirects_to_gender(self): + def test_redirects_to_ethnicity(self): ResponseSetFactory.create(user=self.user, eligible=True) response = self.client.post( @@ -115,7 +115,7 @@ def test_redirects_to_gender(self): self.valid_params ) - self.assertRedirects(response, reverse("questions:gender")) + self.assertRedirects(response, reverse("questions:ethnicity")) def test_redirects_to_responses_if_change_query_param_is_true(self): ResponseSetFactory.create(user=self.user, eligible=True) diff --git a/lung_cancer_screening/questions/tests/unit/views/test_weight.py b/lung_cancer_screening/questions/tests/unit/views/test_weight.py index 25066b71..74aba1f9 100644 --- a/lung_cancer_screening/questions/tests/unit/views/test_weight.py +++ b/lung_cancer_screening/questions/tests/unit/views/test_weight.py @@ -141,7 +141,7 @@ def test_creates_a_weight_response(self): response_set.weight_response.metric, self.valid_weight * 10 ) - def test_redirects_to_sex_at_birth(self): + def test_redirects_to_gender(self): ResponseSetFactory.create(user=self.user, eligible=True) response = self.client.post( @@ -149,7 +149,7 @@ def test_redirects_to_sex_at_birth(self): self.valid_params ) - self.assertRedirects(response, reverse("questions:sex_at_birth")) + self.assertRedirects(response, reverse("questions:gender")) def test_redirects_to_responses_if_change_query_param_is_true(self): ResponseSetFactory.create(user=self.user, eligible=True) diff --git a/lung_cancer_screening/questions/views/ethnicity.py b/lung_cancer_screening/questions/views/ethnicity.py index f83efa93..a4ee8a44 100644 --- a/lung_cancer_screening/questions/views/ethnicity.py +++ b/lung_cancer_screening/questions/views/ethnicity.py @@ -13,4 +13,4 @@ class EthnicityView(LoginRequiredMixin, EnsureResponseSet, EnsureEligibleMixin, form_class = EthnicityForm model = EthnicityResponse success_url = reverse_lazy("questions:education") - back_link_url = reverse_lazy("questions:gender") + back_link_url = reverse_lazy("questions:sex_at_birth") diff --git a/lung_cancer_screening/questions/views/gender.py b/lung_cancer_screening/questions/views/gender.py index 1399b596..7d24705a 100644 --- a/lung_cancer_screening/questions/views/gender.py +++ b/lung_cancer_screening/questions/views/gender.py @@ -9,8 +9,8 @@ class GenderView(LoginRequiredMixin, EnsureResponseSet, EnsureEligibleMixin, QuestionBaseView): - template_name = "question_form.jinja" + template_name = "gender.jinja" form_class = GenderForm model = GenderResponse - success_url = reverse_lazy("questions:ethnicity") - back_link_url = reverse_lazy("questions:sex_at_birth") + success_url = reverse_lazy("questions:sex_at_birth") + back_link_url = reverse_lazy("questions:weight") diff --git a/lung_cancer_screening/questions/views/sex_at_birth.py b/lung_cancer_screening/questions/views/sex_at_birth.py index bc6da579..4ec045f1 100644 --- a/lung_cancer_screening/questions/views/sex_at_birth.py +++ b/lung_cancer_screening/questions/views/sex_at_birth.py @@ -12,5 +12,5 @@ class SexAtBirthView(LoginRequiredMixin, EnsureResponseSet, EnsureEligibleMixin, template_name = "sex_at_birth.jinja" form_class = SexAtBirthForm model = SexAtBirthResponse - success_url = reverse_lazy("questions:gender") - back_link_url = reverse_lazy("questions:weight") + success_url = reverse_lazy("questions:ethnicity") + back_link_url = reverse_lazy("questions:gender") diff --git a/lung_cancer_screening/questions/views/weight.py b/lung_cancer_screening/questions/views/weight.py index fff1a839..b24fd5ca 100644 --- a/lung_cancer_screening/questions/views/weight.py +++ b/lung_cancer_screening/questions/views/weight.py @@ -16,7 +16,7 @@ class WeightView(LoginRequiredMixin, EnsureResponseSet, EnsureEligibleMixin, QuestionBaseView): template_name = "weight.jinja" model = WeightResponse - success_url = reverse_lazy("questions:sex_at_birth") + success_url = reverse_lazy("questions:gender") back_link_url = reverse_lazy("questions:height") def get_form_class(self):