forms.py 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/usr/bin/env python
  2. # -*- coding=UTF-8 -*-
  3. # **************************************************************************
  4. # Copyright © 2016 jianglin
  5. # File Name: forms.py
  6. # Author: jianglin
  7. # Email: xiyang0807@gmail.com
  8. # Created: 2016-05-20 18:08:44 (CST)
  9. # Last Update:星期日 2016-7-10 21:11:14 (CST)
  10. # By:
  11. # Description:
  12. # **************************************************************************
  13. from flask_wtf import Form
  14. from wtforms import StringField, TextAreaField, SelectField, PasswordField
  15. from wtforms.validators import DataRequired, Length, EqualTo
  16. from flask_babelex import lazy_gettext as _
  17. class ProfileForm(Form):
  18. introduce = TextAreaField('个人介绍:', [Length(min=4)])
  19. school = StringField('所在学校:', [Length(min=4, max=20)])
  20. word = TextAreaField('个性签名:', [Length(min=4)])
  21. class PasswordForm(Form):
  22. password = PasswordField('原密码:', [DataRequired(), Length(min=4, max=20)])
  23. password_n = PasswordField('新密码:',
  24. [DataRequired(), Length(min=4, max=20),
  25. EqualTo('password_nn')])
  26. password_nn = PasswordField('重复新密码:', [DataRequired()])
  27. choices = [(1, '所有人'), (2, '已登陆用户'), (3, '仅自己')]
  28. class PrivacyForm(Form):
  29. online_status = SelectField('登录状态', coerce=int, choices=choices)
  30. topic_list = SelectField('主题列表', coerce=int, choices=choices)
  31. rep_list = SelectField('回复列表', coerce=int, choices=choices)
  32. ntb_list = SelectField('笔记列表', coerce=int, choices=choices)
  33. collect_list = SelectField('收藏列表', coerce=int, choices=choices)