-
Notifications
You must be signed in to change notification settings - Fork 0
/
forms.py
62 lines (47 loc) · 2.77 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
from flask_wtf import FlaskForm
from wtforms import Form, BooleanField, PasswordField, StringField, DateField, validators
from wtforms.validators import DataRequired, Email, Length, Optional
from wtforms.fields.html5 import DateField
class SignUpForm(FlaskForm):
""" Form used to signup a new user. """
email_address = StringField('Email Address', validators=[
DataRequired(), Email()])
first_name = StringField('First Name', validators=[DataRequired()])
last_name = StringField('Last Name', validators=[DataRequired()])
img_url = StringField('Personal Image URL (Optional)',
validators=[Optional()])
birthday = DateField('Birthday', validators=[DataRequired()])
username = StringField('Username', validators=[DataRequired()])
password = PasswordField('Password', validators=[DataRequired()])
class LoginForm(FlaskForm):
""" Form used to login an existing user. """
username = StringField('Username', validators=[DataRequired()])
password = PasswordField('Password', validators=[DataRequired()])
class AddFriendForm(FlaskForm):
""" Form used for a signedin user to add a friend. """
email_address = StringField('Email Address', validators=[
DataRequired(), Email()])
first_name = StringField('First Name', validators=[DataRequired()])
last_name = StringField('Last Name', validators=[DataRequired()])
img_url = StringField('Image URL (Optional)', validators=[Optional()])
greeting = StringField('Greeting (Optional)', validators=[Optional()])
birthday = DateField('Birthday', validators=[DataRequired()])
class EditFriendForm(FlaskForm):
""" Form used for a signedin user to add a friend. """
email_address = StringField('Email Address', validators=[
DataRequired(), Email()])
first_name = StringField('First Name', validators=[DataRequired()])
last_name = StringField('Last Name', validators=[DataRequired()])
img_url = StringField('Image URL (Optional)', validators=[Optional()])
birthday = DateField('Birthday', validators=[DataRequired()])
greeting = StringField(
'New Birthday Greeting (Optional):', validators=[Optional()])
class EditUserForm(FlaskForm):
""" Form used for a signedin user to add a friend. """
email_address = StringField('Email Address', validators=[
DataRequired(), Email()])
first_name = StringField('First Name', validators=[DataRequired()])
last_name = StringField('Last Name', validators=[DataRequired()])
username = StringField('Username', validators=[DataRequired()])
img_url = StringField('Image URL (Optional)', validators=[Optional()])
birthday = DateField('Birthday', validators=[DataRequired()])