mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-24 00:07:02 -04:00
Convert radios in edit org type page (basic)
Changes the OrganisationTypeField class used by OrganisationOrganisationTypeForm.organisation_type OrganisationTypeField is also used by the forms in /add-service: - CreateServiceForm - CreateNhsServiceForm Because of that, this commit also includes changes to the template for that route. Note: this also moves where OrganisationTypeField appears in app/main/forms.py so it can use GovukRadiosField.
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user