Add basic flow for adding email _or_ sms templates

Templates now have:
- a type (email or sms)
- a subject (if they are email templates)

We don’t want two completely separate view files for email and SMS, because they
would have an enormous amount of repetition.

So this commit adds
- different templates for SMS and email templates
- different form objects for SMS and email templates

…and wires them up.
This commit is contained in:
Chris Hill-Scott
2016-02-22 14:45:13 +00:00
parent 8247f3d568
commit c6de605311
14 changed files with 160 additions and 107 deletions

View File

@@ -188,7 +188,7 @@ class ConfirmPasswordForm(Form):
raise ValidationError('Invalid password')
class TemplateForm(Form):
class SMSTemplateForm(Form):
name = StringField(
u'Template name',
validators=[DataRequired(message="Template name cannot be empty")])
@@ -198,6 +198,13 @@ class TemplateForm(Form):
validators=[DataRequired(message="Template content cannot be empty")])
class EmailTemplateForm(SMSTemplateForm):
subject = StringField(
u'Subject',
validators=[DataRequired(message="Subject cannot be empty")])
class ForgotPasswordForm(Form):
email_address = email_address()