-
Notifications
You must be signed in to change notification settings - Fork 197
Expand file tree
/
Copy pathforms.py
More file actions
54 lines (46 loc) · 1.43 KB
/
forms.py
File metadata and controls
54 lines (46 loc) · 1.43 KB
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
# project/forms.py
from flask_wtf import FlaskForm as Form
from wtforms import StringField, DateField, IntegerField, \
SelectField, PasswordField
from wtforms.validators import DataRequired, Length, EqualTo
class AddTaskForm(Form):
task_id = IntegerField()
name = StringField('Task Name', validators=[DataRequired()])
due_date = DateField(
'Date Due (mm/dd/yyyy)',
validators=[DataRequired()], format='%m/%d/%Y'
)
priority = SelectField(
'Priority',
validators=[DataRequired()],
choices=[
('1', '1'), ('2', '2'), ('3', '3'), ('4', '4'), ('5', '5'),
('6', '6'), ('7', '7'), ('8', '8'), ('9', '9'), ('10', '10')
]
)
status = IntegerField('Status')
class RegisterForm(Form):
name = StringField(
'Username',
validators=[DataRequired(), Length(min=6, max=25)]
)
email = StringField(
'Email',
validators=[DataRequired(), Length(min=6, max=40)]
)
password = PasswordField(
'Password',
validators=[DataRequired(), Length(min=6, max=40)])
confirm = PasswordField(
'Repeat Password',
validators=[DataRequired(), EqualTo('password', message='Passwords must match')]
)
class LoginForm(Form):
name = StringField(
'Username',
validators=[DataRequired()]
)
password = PasswordField(
'Password',
validators=[DataRequired()]
)