Add radio buttons for choosing the API key type

Best-guess wording for what the labels and question should be.

Adds a macro for rendering radio buttons from a WTForms field.
This commit is contained in:
Chris Hill-Scott
2016-06-29 17:10:49 +01:00
parent 49d8e68589
commit 7fcd56dc02
6 changed files with 67 additions and 6 deletions

View File

@@ -12,7 +12,8 @@ from wtforms import (
FileField,
BooleanField,
HiddenField,
IntegerField
IntegerField,
RadioField
)
from wtforms.fields.html5 import EmailField, TelField
from wtforms.validators import (DataRequired, Email, Length, Regexp)
@@ -291,6 +292,18 @@ class CreateKeyForm(Form):
self.existing_key_names = [x.lower() for x in existing_key_names]
super(CreateKeyForm, self).__init__(*args, **kwargs)
key_type = RadioField(
'What should Notify do when you use this key?',
choices=[
('normal', 'Send messages to anyone'),
('test', 'Simulate sending messages to anyone'),
('team', 'Only send messages to members of your team')
],
validators=[
DataRequired()
]
)
key_name = StringField(u'Description of key', validators=[
DataRequired(message='You need to give the key a name')
])