-
Notifications
You must be signed in to change notification settings - Fork 1
/
forms.py
36 lines (24 loc) · 1.27 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
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, TextAreaField, IntegerField, BooleanField
from wtforms.validators import DataRequired, Email, Length, Optional
class RegisterForm(FlaskForm):
"""Form for adding users."""
username = StringField(label='Username', validators=[DataRequired()])
email = StringField(label='Email', validators=[DataRequired(), Email()])
password = PasswordField(label='Password', validators=[Length(min=6)])
class UserEditForm(FlaskForm):
"""Form for editing users. Enter password to validate changes."""
username = StringField(label='Username')
email = StringField(label='Email', validators=[Email()])
password = PasswordField(label='Password', validators=[DataRequired()])
class LoginForm(FlaskForm):
"""Login form."""
identifier = StringField(label='Username or Email', validators=[DataRequired()])
password = PasswordField(label='Password', validators=[Length(min=6)])
class SavedSearchEditForm(FlaskForm):
"""Form for editing saved search"""
name = StringField(label='Name')
query_string = StringField(label='Search term')
accessible = BooleanField(label='Accessible')
unisex = BooleanField(label='Unisex')
changing_table = BooleanField(label='Changing Table')