Files
notifications-admin/app/main/views/styleguide.py
T

34 lines
1.0 KiB
Python
Raw Normal View History

2016-02-15 11:47:54 +00:00
from flask import render_template, current_app, abort
2016-01-11 13:15:10 +00:00
from flask_wtf import Form
2016-02-02 17:28:30 +00:00
from wtforms import StringField, PasswordField, TextAreaField, FileField, validators
from notifications_utils.template import Template
2016-01-11 11:13:06 +00:00
from app.main import main
@main.route('/_styleguide')
def styleguide():
2016-01-11 13:15:10 +00:00
2016-02-15 11:47:54 +00:00
if not current_app.config['SHOW_STYLEGUIDE']:
abort(404)
2016-01-11 13:15:10 +00:00
class FormExamples(Form):
username = StringField(u'Username')
password = PasswordField(u'Password', [validators.required()])
2016-02-15 11:32:27 +00:00
code = StringField('Enter code')
2016-01-11 13:15:10 +00:00
message = TextAreaField(u'Message')
2016-02-02 17:28:30 +00:00
file_upload = FileField('Upload a CSV file to add your recipients details')
2016-01-11 13:15:10 +00:00
2016-02-21 11:15:15 +00:00
sms = "Your vehicle tax for ((registration number)) is due on ((date)). Renew online at www.gov.uk/vehicle-tax"
2016-01-11 13:15:10 +00:00
form = FormExamples()
2016-02-21 11:15:15 +00:00
form.message.data = sms
2016-01-11 13:15:10 +00:00
form.validate()
2016-02-21 11:15:15 +00:00
template = Template({'content': sms})
2016-01-11 13:15:10 +00:00
return render_template(
'views/styleguide.html',
2016-02-21 11:15:15 +00:00
form=form,
template=template
2016-01-11 13:15:10 +00:00
)