# -*- coding:utf-8 -*-
from flask_wtf import Form
from wtforms import StringField, PasswordField, SubmitField, BooleanField, DecimalField, IntegerField, SelectField
from wtforms.validators import DataRequired, EqualTo, Regexp
from models.db_bean import GoodType
class RegisterForm(Form):
"""用户注册表单"""
user_name = StringField(label=u"用户名", validators=[DataRequired(u"用户名不能为为空!")])
password = PasswordField(label=u"登录密码", validators=[DataRequired(u"登录密码不能为空!"), Regexp(
"^(?=.*[0-9])(?=.*[a-zA-Z])(?=.*[!@#$_&*+-])[0-9a-zA-Z!@#$_&*+-]{8,18}$",
message=u"登录密码格式错误!")])
check_password = PasswordField(label=u"确认登录密码",
validators=[DataRequired(u"确认登录密码不能为空!"), EqualTo("password", message=u"两次密码不一致"),
Regexp(
"^(?=.*[0-9])(?=.*[a-zA-Z])(?=.*[!@#$_&*+-])[0-9a-zA-Z!@#$_&*+-]{8,18}$",
message=u"登录密码格式错误!")])
pay_password = PasswordField(label=u"支付密码", validators=[DataRequired(u"支付密码不能为空!"), Regexp(
"^(?=.*[0-9])(?=.*[a-zA-Z])(?=.*[!@#$_&*+-])[0-9a-zA-Z!@#$_&*+-]{8,18}$",
message=u"支付密码格式错误!")])
check_pay_password = PasswordField(label=u"确认支付密码",
validators=[DataRequired(u"确认支付密码不能为空!"),
EqualTo("pay_password", message=u"两次密码不一致"),
Regexp(
"^(?=.*[0-9])(?=.*[a-zA-Z])(?=.*[!@#$_&*+-])[0-9a-zA-Z!@#$_&*+-]{8,18}$",
message=u"支付密码格式错误!")])
remember_me = BooleanField(label=u'记住密码', default=False)
submit = SubmitField(label=u"注册")
class UserForm(Form):
"""用户登录表单"""
user_name = StringField(label=u"用户名", validators=[DataRequired(u"用户名不能为为空!")])
password = PasswordField(label=u"登录密码", validators=[DataRequired(u"登录密码不能为空!"), Regexp(
"^(?=.*[0-9])(?=.*[a-zA-Z])(?=.*[!@#$_&*+-])[0-9a-zA-Z!@#$_&*+-]{8,18}$",
message=u"登录密码格式错误!")])
check_password = PasswordField(label=u"确认登录密码",
validators=[DataRequired(u"确认登录密码不能为空!"), EqualTo("password", message=u"两次密码不一致"),
Regexp(
"^(?=.*[0-9])(?=.*[a-zA-Z])(?=.*[!@#$_&*+-])[0-9a-zA-Z!@#$_&*+-]{8,18}$",
message=u"登录密码格式错误!")])
remember_me = BooleanField(label=u'记住密码', default=False)
submit = SubmitField(label=u"登录")
class GoodTypeForm(Form):
"""商品表单"""
type_name = StringField(label=u"商品类型", validators=[DataRequired(u"商品类型不能为空!")])
submit = SubmitField(label=u"添加")
class GoodForm(Form):
"""商品表单"""
good_name = StringField(label=u"商品名称", validators=[DataRequired(u"商品名称不能为空!")])
try:
good_types = [(g.id, (g.id, g.type_name)) for g in GoodType.query.all()]
type = SelectField(label=u"商品类型", choices=good_types, coerce=int, validators=[DataRequired(u"商品类型不能为空!")])
except Exception:
pass
price = DecimalField(label=u"商品单价", validators=[DataRequired(u"商品单价格式错误!")])
stock = IntegerField(label=u"商品库存", validators=[DataRequired(u"商品库存格式错误!")])
submit = SubmitField(label=u"添加")
class PaymentForm(Form):
"""付款表单"""
pay_password = PasswordField(label=u"支付密码", validators=[DataRequired(u"支付密码不能为空!")])
submit = SubmitField(label=u"付款")
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
bean.rar (89个子文件)
bean
models
db_bean.py 2KB
__init__.py 28B
myconfig.py 384B
__pycache__
db_bean.cpython-37.pyc 2KB
myconfig.cpython-36.pyc 474B
forms.cpython-37.pyc 4KB
db_bean.cpython-36.pyc 2KB
__init__.cpython-37.pyc 147B
__init__.cpython-36.pyc 143B
forms.cpython-36.pyc 4KB
myconfig.cpython-37.pyc 478B
forms.py 4KB
manage.py 351B
app.py 594B
migrations
env.py 2KB
alembic.ini 815B
script.py.mako 412B
__pycache__
env.cpython-36.pyc 2KB
versions
5135a40092e_init_migrations.py 2KB
__pycache__
5135a40092e_init_migrations.cpython-36.pyc 2KB
README 38B
index.wsgi 112B
__init__.py 28B
blueprint
good.py 2KB
user.py 2KB
cart.py 1KB
__init__.py 681B
goodtype.py 849B
payment.py 2KB
index.py 2KB
__pycache__
good.cpython-36.pyc 2KB
index.cpython-37.pyc 2KB
goodtype.cpython-37.pyc 1KB
good.cpython-37.pyc 2KB
user.cpython-36.pyc 2KB
user.cpython-37.pyc 2KB
payment.cpython-37.pyc 1KB
cart.cpython-36.pyc 1KB
payment.cpython-36.pyc 2KB
index.cpython-36.pyc 2KB
__init__.cpython-37.pyc 751B
cart.cpython-37.pyc 1KB
__init__.cpython-36.pyc 777B
goodtype.cpython-36.pyc 1KB
test
test_database.py 2KB
__pycache__
__pycache__
app.cpython-36.pyc 655B
__init__.cpython-36.pyc 136B
app.cpython-37.pyc 659B
templates
good_type.html 290B
index.html 356B
good.html 289B
index
3_admin.html 3KB
1_cart.html 2KB
0_body.html 498B
2_view_goods.html 1KB
register.html 282B
login.html 282B
payment.html 286B
base.html 938B
payment_records.html 318B
include
form_good.html 2KB
form_good_type.html 810B
form_user_login.html 2KB
payment_records.html 763B
form_user_register.html 3KB
form_payment.html 2KB
navigation.html 3KB
footer.html 143B
网站需求 310B
static
js
npm.js 484B
jquery.min.js 82KB
bootstrap.js 68KB
bootstrap.min.js 36KB
pic
shopping.jpg 8KB
red_pocket.jpg 1.76MB
fonts
glyphicons-halflings-regular.ttf 44KB
glyphicons-halflings-regular.woff2 18KB
glyphicons-halflings-regular.eot 20KB
glyphicons-halflings-regular.svg 106KB
glyphicons-halflings-regular.woff 23KB
css
bootstrap-theme.min.css.map 25KB
bootstrap-theme.css.map 47KB
bootstrap.min.css.map 529KB
bootstrap.min.css 118KB
bootstrap-theme.min.css 23KB
bootstrap-theme.css 26KB
bootstrap.css.map 380KB
bootstrap.css 143KB
add_data.py 2KB
共 89 条
- 1
资源评论
「已注销」
- 粉丝: 117
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功