Plug GovukRadiosField into edit sms|email pages

Proof of concept for the GovukRadiosField class.

Includes the removal of the a DataRequired
validator. This doesn't seem to be needed as the
RadioField superclass catches any submissions
without any data from field.choices in its
pre_validate method (which also outputs the
correct error message).
This commit is contained in:
Tom Byers
2020-11-11 15:55:55 +00:00
parent dd36137e3f
commit b0bab205da
3 changed files with 3 additions and 6 deletions

View File

@@ -1294,14 +1294,13 @@ class BaseTemplateForm(StripWhitespaceForm):
NoCommasInPlaceHolders()
]
)
process_type = RadioField(
process_type = GovukRadiosField(
"Use priority queue?",
choices=[
('priority', 'Yes'),
('normal', 'No'),
],
thing='yes or no',
validators=[DataRequired()],
default='normal'
)

View File

@@ -2,7 +2,6 @@
{% from "components/textbox.html" import textbox %}
{% from "components/page-header.html" import page_header %}
{% from "components/page-footer.html" import sticky_page_footer %}
{% from "components/radios.html" import radios %}
{% from "components/form.html" import form_wrapper %}
{% block service_page_title %}
@@ -26,7 +25,7 @@
{{ textbox(form.subject, width='1-1', highlight_placeholders=True, rows=2) }}
{{ textbox(form.template_content, highlight_placeholders=True, width='1-1', rows=8) }}
{% if current_user.platform_admin %}
{{ radios(form.process_type) }}
{{ form.process_type }}
{% endif %}
{{ sticky_page_footer(
'Save'

View File

@@ -2,7 +2,6 @@
{% from "components/textbox.html" import textbox %}
{% from "components/page-header.html" import page_header %}
{% from "components/page-footer.html" import sticky_page_footer %}
{% from "components/radios.html" import radios %}
{% from "components/form.html" import form_wrapper %}
{% block service_page_title %}
@@ -27,7 +26,7 @@
<div class="govuk-grid-column-two-thirds">
{{ textbox(form.template_content, highlight_placeholders=True, width='1-1', rows=5) }}
{% if current_user.platform_admin %}
{{ radios(form.process_type) }}
{{ form.process_type }}
{% endif %}
{{ sticky_page_footer(
'Save'