mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-04-28 13:11:05 -04:00
Done using isort[1], with the following command:
```
isort -rc ./app ./tests
```
Adds linting to the `run_tests.sh` script to stop badly-sorted imports
getting re-introduced.
Chosen style is ‘Vertical Hanging Indent’ with trailing commas, because
I think it gives the cleanest diffs, eg:
```
from third_party import (
lib1,
lib2,
lib3,
lib4,
)
```
1. https://pypi.python.org/pypi/isort
41 lines
1.0 KiB
Python
41 lines
1.0 KiB
Python
from flask import abort, current_app, render_template
|
||
from flask_wtf import FlaskForm as Form
|
||
from notifications_utils.template import Template
|
||
from wtforms import (
|
||
FileField,
|
||
PasswordField,
|
||
StringField,
|
||
TextAreaField,
|
||
validators,
|
||
)
|
||
|
||
from app.main import main
|
||
|
||
|
||
@main.route('/_styleguide')
|
||
def styleguide():
|
||
|
||
if not current_app.config['SHOW_STYLEGUIDE']:
|
||
abort(404)
|
||
|
||
class FormExamples(Form):
|
||
username = StringField(u'Username')
|
||
password = PasswordField(u'Password', [validators.required()])
|
||
code = StringField('Enter code')
|
||
message = TextAreaField(u'Message')
|
||
file_upload = FileField('Upload a CSV file to add your recipients’ details')
|
||
|
||
sms = "Your vehicle tax for ((registration number)) is due on ((date)). Renew online at www.gov.uk/vehicle-tax"
|
||
|
||
form = FormExamples()
|
||
form.message.data = sms
|
||
form.validate()
|
||
|
||
template = Template({'content': sms})
|
||
|
||
return render_template(
|
||
'views/styleguide.html',
|
||
form=form,
|
||
template=template
|
||
)
|