Make ‘template type’ radio buttons not <select>

Because burn your select tags[1]

This commit hard codes the markup for the time being until I can work out how
to get WTForms outputting the markup I want.

1. https://www.youtube.com/watch?v=CUkMCQR4TpY
This commit is contained in:
Chris Hill-Scott
2016-01-22 12:19:15 +00:00
parent 9ee8610da0
commit cd38d54be7
2 changed files with 12 additions and 3 deletions

View File

@@ -7,7 +7,7 @@ from wtforms import (
ValidationError,
TextAreaField,
FileField,
SelectField
RadioField
)
from wtforms.validators import DataRequired, Email, Length, Regexp
@@ -193,7 +193,8 @@ class TemplateForm(Form):
name = StringField(
u'Template name',
validators=[DataRequired(message="Template name cannot be empty")])
template_type = SelectField(u'Template type', choices=[('sms', 'SMS')])
template_type = RadioField(u'Template type', choices=[('sms', 'SMS')])
template_content = TextAreaField(
u'Message',
validators=[DataRequired(message="Template content cannot be empty")])

View File

@@ -12,7 +12,15 @@ GOV.UK Notify | Edit template
<form method="post">
{{ textbox(form.name) }}
{{ textbox(form.template_type) }}
<fieldset class="form-group">
<legend class="form-label">
Template type
</legend>
<label class="block-label" for="template_type">
<input type="radio" name="template_type" id="template_type" checked="checked" value="sms" />
SMS
</label>
</fieldset>
{{ textbox(form.template_content, highlight_tags=True) }}
{{ page_footer(
'Save',