-
Notifications
You must be signed in to change notification settings - Fork 0
/
forms.py
52 lines (42 loc) · 1.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
# coding=utf-8
"""
Forms package
"""
from wtforms import StringField, PasswordField, validators
from wtforms.fields.html5 import DateField, IntegerField
from wtforms.validators import InputRequired, Length, Email, DataRequired, EqualTo
from flask_wtf import FlaskForm
class RegisterForm(FlaskForm):
"""
Register
"""
name = StringField('Name', validators=[InputRequired(), Length(min=4)])
email = StringField('Email', validators=[InputRequired(), Email(message='invalid email')])
# number = StringField('Number', validators=[InputRequired(), Length(min=4, max=15)])
password = PasswordField('Password', validators=[InputRequired(), DataRequired(), EqualTo('confirm', message='Passwords Dont Match'), Length(min=8, max=80)])
confirm = PasswordField('Repeat Password')
class AddNewForm(FlaskForm):
"""
AddNew
"""
name = StringField('Name', validators=[InputRequired(), Length(min=4)])
email = StringField('Email', validators=[InputRequired(), Email(message='invalid email')])
hours = IntegerField('Hours', validators=[InputRequired()])
date = DateField('Start Date', format='%Y-%m-%d')
space = StringField('Space', validators=[InputRequired(), Length(min=3)])
class LoginForm(FlaskForm):
"""
LoginForm
"""
name = StringField('Username', validators=[
InputRequired(), Length(min=4)])
password = PasswordField('Password', validators=[
InputRequired(), Length(min=8)])
class AdminLoginForm(FlaskForm):
"""
LoginForm
"""
name = StringField('Username', validators=[
InputRequired(), Length(min=4)])
password = PasswordField('Password', validators=[
InputRequired(), Length(min=8)])