-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathforms.py
More file actions
48 lines (43 loc) · 1.42 KB
/
forms.py
File metadata and controls
48 lines (43 loc) · 1.42 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
from flask_wtf import Form
from wtforms import TextField, PasswordField, SelectField
from wtforms.validators import DataRequired, Length, EqualTo
class LoginForm(Form):
username = TextField('Username', validators=[DataRequired()])
password = PasswordField('Password', validators=[DataRequired()])
class RegisterForm(Form):
firstname = TextField(
'firstname',
validators=[DataRequired()]
)
lastname = TextField(
'lastname',
validators=[DataRequired()]
)
hostel = SelectField(
'hostel',
choices=[('ambera', 'Amber A'), ('amberb', 'Amber B'), ('garneta', 'Garnet A'), ('garnetb', 'Garnet B'), ('garnetc', 'Garnet C'), ('zircona', 'Zircon A'), ('zirconb', 'Zircon B'), ('zirconc', 'Zircon C'), ('agate', 'Agate'), ('diamond', 'Diamond'), ('coral', 'Coral'), ('jade', 'Jade')],
validators=[DataRequired()]
)
room = TextField(
'room',
validators=[DataRequired()]
)
year = SelectField(
'year',
choices=[('first', 'First'), ('second', 'Second'), ('third', 'Third'), ('fourth', 'Fourth')],
validators=[DataRequired()]
)
username = TextField(
'username',
validators=[DataRequired(), Length(min=3, max=25)]
)
password = PasswordField(
'password',
validators=[DataRequired(), Length(min=3, max=25)]
)
confirm = PasswordField(
'Repeat Password',
validators=[DataRequired(), EqualTo('password', message='Passwords must match.')]
)
class SearchForm(Form):
search = TextField('search', validators=[DataRequired()])