-
Notifications
You must be signed in to change notification settings - Fork 86
/
forms.py
56 lines (39 loc) · 2.11 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
from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField, SelectField, PasswordField
from wtforms.validators import DataRequired, EqualTo, Length
class Login(FlaskForm):
account = StringField(u'账号', validators=[DataRequired()])
password = PasswordField(u'密码', validators=[DataRequired()])
submit = SubmitField(u'登录')
class ChangePasswordForm(FlaskForm):
old_password = PasswordField(u'原密码', validators=[DataRequired()])
password = PasswordField(u'新密码', validators=[DataRequired(), EqualTo('password2', message=u'两次密码必须一致!')])
password2 = PasswordField(u'确认新密码', validators=[DataRequired()])
submit = SubmitField(u'确认修改')
class EditInfoForm(FlaskForm):
name = StringField(u'用户名', validators=[Length(1, 32)])
submit = SubmitField(u'提交')
class SearchBookForm(FlaskForm):
methods = [('book_name', '书名'), ('author', '作者'), ('class_name', '类别'), ('isbn', 'ISBN')]
method = SelectField(choices=methods, validators=[DataRequired()], coerce=str)
content = StringField(validators=[DataRequired()])
submit = SubmitField('搜索')
class SearchStudentForm(FlaskForm):
card = StringField(validators=[DataRequired()])
submit = SubmitField('搜索')
class StoreForm(FlaskForm):
barcode = StringField(validators=[DataRequired(), Length(6)])
isbn = StringField(validators=[DataRequired(), Length(13)])
location = StringField(validators=[DataRequired(), Length(1, 32)])
submit = SubmitField(u'提交')
class NewStoreForm(FlaskForm):
isbn = StringField(validators=[DataRequired(), Length(13)])
book_name = StringField(validators=[DataRequired(), Length(1, 64)])
press = StringField(validators=[DataRequired(), Length(1, 32)])
author = StringField(validators=[DataRequired(), Length(1, 64)])
class_name = StringField(validators=[DataRequired(), Length(1, 64)])
submit = SubmitField(u'提交')
class BorrowForm(FlaskForm):
card = StringField(validators=[DataRequired()])
book_name = StringField(validators=[DataRequired()])
submit = SubmitField(u'搜索')