diff --git a/app/main/forms.py b/app/main/forms.py index c8c76c816..726195f49 100644 --- a/app/main/forms.py +++ b/app/main/forms.py @@ -426,26 +426,6 @@ class ForgivingIntegerField(GovukTextInputField): return super().__call__(value=value, **kwargs) -class OrganisationTypeField(RadioField): - def __init__( - self, - *args, - include_only=None, - validators=None, - **kwargs - ): - super().__init__( - *args, - choices=[ - (value, label) for value, label in Organisation.TYPES - if not include_only or value in include_only - ], - thing='the type of organisation', - validators=validators or [], - **kwargs - ) - - class FieldWithNoneOption(): # This is a special value that is specific to our forms. This is @@ -951,6 +931,26 @@ class OnOffField(GovukRadiosField): ) +class OrganisationTypeField(GovukRadiosField): + def __init__( + self, + *args, + include_only=None, + validators=None, + **kwargs + ): + super().__init__( + *args, + choices=[ + (value, label) for value, label in Organisation.TYPES + if not include_only or value in include_only + ], + thing='the type of organisation', + validators=validators or [], + **kwargs + ) + + # guard against data entries that aren't a role in permissions def filter_by_permissions(valuelist): if valuelist is None: @@ -1168,10 +1168,8 @@ class OrganisationOrganisationTypeForm(StripWhitespaceForm): class OrganisationCrownStatusForm(StripWhitespaceForm): - crown_status = RadioField( - ( - 'Is this organisation a crown body?' - ), + crown_status = GovukRadiosField( + 'Is this organisation a crown body?', choices=[ ('crown', 'Yes'), ('non-crown', 'No'), diff --git a/app/templates/views/add-service.html b/app/templates/views/add-service.html index 66d25fa0e..d15373641 100644 --- a/app/templates/views/add-service.html +++ b/app/templates/views/add-service.html @@ -1,5 +1,4 @@ {% extends "withoutnav_template.html" %} -{% from "components/radios.html" import radios %} {% from "components/page-header.html" import page_header %} {% from "components/page-footer.html" import page_footer %} {% from "components/form.html" import form_wrapper %} @@ -20,7 +19,7 @@ {{ form.name(param_extensions={"hint": {"text": "You can change this later"}}) }} {% if not default_organisation_type %} - {{ radios(form.organisation_type) }} + {{ form.organisation_type }} {% endif %} {{ page_footer('Add service') }} diff --git a/app/templates/views/organisations/add-organisation.html b/app/templates/views/organisations/add-organisation.html index 8414df2ba..30c09bd8f 100644 --- a/app/templates/views/organisations/add-organisation.html +++ b/app/templates/views/organisations/add-organisation.html @@ -1,7 +1,6 @@ {% extends "withoutnav_template.html" %} {% from "components/page-header.html" import page_header %} {% from "components/page-footer.html" import page_footer %} -{% from "components/radios.html" import radios %} {% from "components/form.html" import form_wrapper %} {% block per_page_title %} @@ -26,8 +25,8 @@ {{ page_header('New organisation') }} {% call form_wrapper() %} {{ form.name }} - {{ radios(form.organisation_type) }} - {{ radios(form.crown_status) }} + {{ form.organisation_type }} + {{ form.crown_status }} {{ page_footer('Save') }} {% endcall %} {% endblock %} diff --git a/app/templates/views/organisations/organisation/settings/edit-crown-status.html b/app/templates/views/organisations/organisation/settings/edit-crown-status.html index 1ab642015..4f325eabf 100644 --- a/app/templates/views/organisations/organisation/settings/edit-crown-status.html +++ b/app/templates/views/organisations/organisation/settings/edit-crown-status.html @@ -1,4 +1,3 @@ -{% from "components/radios.html" import radios %} {% from "components/page-footer.html" import page_footer %} {% from "components/page-header.html" import page_header %} {% from "components/form.html" import form_wrapper %} @@ -17,7 +16,7 @@