forms.py 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #*************************************************************************
  2. # Copyright © 2015 JiangLin. All rights reserved.
  3. # File Name: forms.py
  4. # Author:JiangLin
  5. # Mail:xiyang0807@gmail.com
  6. # Created Time: 2015-10-29 07:09:54
  7. #*************************************************************************
  8. #!/usr/bin/env python
  9. # -*- coding=UTF-8 -*-
  10. from flask.ext.wtf import Form
  11. from wtforms import StringField, PasswordField, BooleanField,\
  12. TextAreaField, SelectField
  13. from maple.forms.forms import Length, DataRequired, EqualTo, Email
  14. class SettingForm(Form):
  15. introduce = TextAreaField('个人介绍:',
  16. [Length(min=4)])
  17. school = StringField('所在学校:',
  18. [Length(min=4,
  19. max=20)])
  20. word = TextAreaField('个性签名:',
  21. [Length(min=4)])
  22. class PrivacyForm(Form):
  23. online_status = SelectField('登录状态',
  24. coerce=int,
  25. choices=[(1, '所有人'), (2, '已登陆用户'),
  26. (3, '仅自己')])
  27. topic_list = SelectField('主题列表',
  28. coerce=int,
  29. choices=[(1, '所有人'), (2, '已登陆用户'),
  30. (3, '仅自己')])
  31. rep_list = SelectField('回复列表',
  32. coerce=int,
  33. choices=[(1, '所有人'), (2, '已登陆用户'),
  34. (3, '仅自己')])
  35. ntb_list = SelectField('笔记列表',
  36. coerce=int,
  37. choices=[(1, '所有人'), (2, '已登陆用户'),
  38. (3, '仅自己')])
  39. collect_list = SelectField('收藏列表',
  40. coerce=int,
  41. choices=[(1, '所有人'), (2, '已登陆用户'),
  42. (3, '仅自己')])
  43. class NewPasswdForm(Form):
  44. passwd = PasswordField('原密码:',
  45. [DataRequired(),
  46. Length(min=4,
  47. max=20)])
  48. npasswd = PasswordField('新密码:',
  49. [DataRequired(),
  50. Length(min=4,
  51. max=20),
  52. EqualTo('rpasswd')])
  53. rpasswd = PasswordField('重复新密码:',
  54. [DataRequired()])