Skip to content

Commit c6b0cce

Browse files
authored
Merge pull request #399 from NHSDigital/dtoss-10724-form-builder-refactor
[DTOSS-10724] form builder refactor
2 parents 03db24b + 38aa660 commit c6b0cce

36 files changed

+776
-611
lines changed

manage_breast_screening/config/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ def boolean_env(key, default=None):
6464
"manage_breast_screening.core",
6565
"manage_breast_screening.auth",
6666
"manage_breast_screening.clinics",
67+
"manage_breast_screening.nhsuk_forms",
6768
"manage_breast_screening.notifications",
6869
"manage_breast_screening.participants",
6970
"manage_breast_screening.mammograms",

manage_breast_screening/core/jinja2/forms/split_date_field.jinja

Lines changed: 0 additions & 43 deletions
This file was deleted.

manage_breast_screening/mammograms/forms/appointment_cannot_go_ahead_form.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from django import forms
22

3-
from manage_breast_screening.core.form_fields import (
3+
from manage_breast_screening.nhsuk_forms.fields import (
44
CharField,
55
ChoiceField,
66
MultipleChoiceField,
@@ -44,7 +44,6 @@ def __init__(self, *args, **kwargs):
4444

4545
stopped_reasons = MultipleChoiceField(
4646
label="Why has this appointment been stopped?",
47-
label_classes="nhsuk-fieldset__legend--m",
4847
hint="Select all that apply",
4948
choices=STOPPED_REASON_CHOICES,
5049
required=True,
@@ -55,7 +54,6 @@ def __init__(self, *args, **kwargs):
5554

5655
decision = ChoiceField(
5756
label="Does the appointment need to be rescheduled?",
58-
label_classes="nhsuk-fieldset__legend--m",
5957
choices=(
6058
("True", "Yes, add participant to reinvite list"),
6159
("False", "No"),

manage_breast_screening/mammograms/forms/ask_for_medical_information_form.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from django import forms
22

3-
from manage_breast_screening.core.form_fields import ChoiceField
3+
from manage_breast_screening.nhsuk_forms.fields import ChoiceField
44

55

66
class AskForMedicalInformationForm(forms.Form):

manage_breast_screening/mammograms/forms/record_medical_information_form.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from django import forms
22

3-
from manage_breast_screening.core.form_fields import ChoiceField
3+
from manage_breast_screening.nhsuk_forms.fields import ChoiceField
44

55

66
class RecordMedicalInformationForm(forms.Form):

manage_breast_screening/mammograms/forms/screening_appointment_form.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
from django import forms
22

3-
from manage_breast_screening.core.form_fields import ChoiceField
3+
from manage_breast_screening.nhsuk_forms.fields import ChoiceField
44

55

66
class ScreeningAppointmentForm(forms.Form):
77
decision = ChoiceField(
88
label="Can the appointment go ahead?",
9-
label_classes="nhsuk-fieldset__legend--m",
109
hint="Before you proceed, check the participant’s identity and confirm that their last mammogram was more than 6 months ago.",
1110
choices=(
1211
("continue", "Yes, go to medical information"),

manage_breast_screening/mammograms/forms/special_appointment_forms.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from django.db.models import TextChoices
33
from django.forms import Textarea
44

5-
from manage_breast_screening.core.form_fields import (
5+
from manage_breast_screening.nhsuk_forms.fields import (
66
CharField,
77
ChoiceField,
88
MultipleChoiceField,
@@ -34,7 +34,6 @@ def __init__(self, *args, participant, **kwargs):
3434
# a special appointment.
3535
self.fields["support_reasons"] = MultipleChoiceField(
3636
label=f"Why does {participant.full_name} need additional support?",
37-
label_classes="nhsuk-fieldset__legend--m",
3837
hint="Select all that apply. When describing support required, include any special requests made by the participant or their carer.",
3938
choices=self.SupportReasons, # type: ignore
4039
required=("support_reasons" not in self.initial),
@@ -54,7 +53,6 @@ def __init__(self, *args, participant, **kwargs):
5453

5554
self.fields["any_temporary"] = ChoiceField(
5655
label="Are any of these reasons temporary?",
57-
label_classes="nhsuk-fieldset__legend--m",
5856
hint="This includes issues that are likely to be resolved by their next mammogram, for example a broken foot or a short-term eye problem.",
5957
choices=self.TemporaryChoices, # type: ignore
6058
required=True,

manage_breast_screening/nhsuk_forms/__init__.py

Whitespace-only changes.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from django.db.models import TextChoices
2+
3+
4+
class YesNo(TextChoices):
5+
YES = ("YES", "Yes")
6+
NO = ("NO", "No")
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from .boolean_field import BooleanField
2+
from .char_field import CharField
3+
from .choice_fields import ChoiceField, MultipleChoiceField
4+
from .integer_field import IntegerField
5+
from .split_date_field import SplitDateField
6+
7+
__all__ = [
8+
"BooleanField",
9+
"CharField",
10+
"IntegerField",
11+
"ChoiceField",
12+
"MultipleChoiceField",
13+
"SplitDateField",
14+
]

0 commit comments

Comments
 (0)