-
-
Notifications
You must be signed in to change notification settings - Fork 43
/
Copy pathforms.py
41 lines (34 loc) · 1.5 KB
/
forms.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
"""Form object declaration."""
from flask_wtf import FlaskForm, RecaptchaField
from wtforms import DateField, PasswordField, SelectField, StringField, SubmitField, TextAreaField
from wtforms.validators import URL, DataRequired, Email, EqualTo, Length
class ContactForm(FlaskForm):
"""Contact form."""
name = StringField("Name", [DataRequired()])
email = StringField("Email", [Email(message="Not a valid email address."), DataRequired()])
body = TextAreaField("Message", [DataRequired(), Length(min=4, message="Your message is too short.")])
submit = SubmitField("Submit")
class SignupForm(FlaskForm):
"""Sign up for a user account."""
email = StringField("Email", [Email(message="Not a valid email address."), DataRequired()])
password = PasswordField(
"Password",
[DataRequired(message="Please enter a password.")],
)
confirmPassword = PasswordField("Repeat Password", [EqualTo(password, message="Passwords must match.")])
title = SelectField(
"Title",
[DataRequired()],
choices=[
("Farmer", "farmer"),
("Corrupt Politician", "politician"),
("No-nonsense City Cop", "cop"),
("Professional Rocket League Player", "rocket"),
("Lonely Guy At A Diner", "lonely"),
("Pokemon Trainer", "pokemon"),
],
)
website = StringField("Website", validators=[URL()])
birthday = DateField("Your Birthday")
recaptcha = RecaptchaField()
submit = SubmitField("Submit")