77 lines
2.4 KiB
Python
77 lines
2.4 KiB
Python
# Copyright Sage Vaillancourt 2021
|
|
|
|
from flask import (Blueprint, render_template, request)
|
|
from wtforms import Form, BooleanField, StringField, TextAreaField, validators
|
|
|
|
|
|
writing_blueprint = Blueprint('writing', __name__,)
|
|
|
|
default_defines = [
|
|
("username", "Sage"),
|
|
("company", "BananaCorp"),
|
|
("jobandpronoun", "Banana Stocker"),
|
|
("skilltypes", "practical"),
|
|
("myskills", "stocking"),
|
|
("closingtext", "I am looking forward to hearing from you"),
|
|
("body", """
|
|
My name is \\username. I would like to work as \\jobandpronoun with your
|
|
company. I think my knowledge of \\myskills will contribute well to your
|
|
team.
|
|
|
|
I am passionate about my work, and think we would work well together.
|
|
|
|
Thank you for your consideration."""),
|
|
]
|
|
|
|
class CLForm(Form):
|
|
username = StringField('Username',
|
|
[validators.Length(min=4, max=99)],
|
|
default="Sage Bongos"
|
|
)
|
|
company = StringField('Company',
|
|
[validators.Length(min=4, max=99)],
|
|
default="BananaCorp"
|
|
)
|
|
jobandpronoun = StringField('Job and Pronoun',
|
|
[validators.Length(min=4, max=99)],
|
|
default="Banana Stocker"
|
|
)
|
|
skilltypes = StringField('Skill Type',
|
|
[validators.Length(min=4, max=99)],
|
|
default="practical"
|
|
)
|
|
myskills = StringField('My Skills',
|
|
[validators.Length(min=4, max=99)],
|
|
default="stocking"
|
|
)
|
|
closingtext = StringField('Closing Text',
|
|
[validators.Length(min=4, max=99)],
|
|
default="I am looking forward to hearing from you"
|
|
)
|
|
body = TextAreaField('Body',
|
|
[validators.Length(min=4, max=9999)],
|
|
default="""
|
|
My name is \\username. I would like to work as \\jobandpronoun with your
|
|
company. I think my knowledge of \\myskills will contribute well to your
|
|
team.
|
|
|
|
I am passionate about my work, and think we would work well together.
|
|
|
|
Thank you for your consideration."""
|
|
)
|
|
|
|
@writing_blueprint.route('/', methods=('GET', 'POST'))
|
|
def index():
|
|
form = CLForm(request.form)
|
|
if request.method == 'POST' and form.validate():
|
|
username = form.username.data
|
|
return 'Thank ' + username
|
|
|
|
for define in default_defines:
|
|
print("\\def \\" + define[0] + " {xxx}")
|
|
return render_template('writing.html',
|
|
form=form,
|
|
unique="abcdef",
|
|
defines=default_defines
|
|
)
|