forms.py 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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-21 22:46:35 (CST)
  9. # Last Update:星期六 2016-6-25 0:53:46 (CST)
  10. # By:
  11. # Description:
  12. # **************************************************************************
  13. from flask.ext.wtf import Form
  14. from wtforms import StringField, PasswordField, TextAreaField, SelectField
  15. from wtforms.validators import Length, DataRequired, EqualTo
  16. choices = [(1, '所有人'), (2, '已登陆用户'), (3, '仅自己')]
  17. class PrivacyForm(Form):
  18. online_status = SelectField('登录状态', coerce=int, choices=choices)
  19. topic_list = SelectField('主题列表', coerce=int, choices=choices)
  20. rep_list = SelectField('回复列表', coerce=int, choices=choices)
  21. ntb_list = SelectField('笔记列表', coerce=int, choices=choices)
  22. collect_list = SelectField('收藏列表', coerce=int, choices=choices)
  23. class ProfileForm(Form):
  24. introduce = TextAreaField('个人介绍:', [Length(max=256)])
  25. school = StringField('所在学校:', [Length(max=256)])
  26. word = TextAreaField('个性签名:', [Length(max=256)])
  27. class PasswordForm(Form):
  28. password = PasswordField('原密码:', [DataRequired(), Length(min=4, max=20)])
  29. password_n = PasswordField('新密码:',
  30. [DataRequired(), Length(min=4, max=20),
  31. EqualTo('password_nn')])
  32. password_nn = PasswordField('重复新密码:', [DataRequired()])