forms.py 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  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-06-03 19:27:58 (CST)
  9. # Last Update:星期一 2016-6-27 14:59:44 (CST)
  10. # By:
  11. # Description:
  12. # **************************************************************************
  13. from flask_wtf import Form
  14. from wtforms import SelectField, StringField
  15. from wtforms.validators import DataRequired
  16. from flask_babel import lazy_gettext as _
  17. class SortForm(Form):
  18. display = SelectField(
  19. _('Choice'),
  20. coerce=int,
  21. choices=[(0, 'all topic'), (1, 'one day'), (2, 'one week'), (
  22. 3, 'one month')])
  23. sort = SelectField('Sort',
  24. coerce=int,
  25. choices=[(0, 'publish'), (1, 'author')])
  26. st = SelectField('Up and Down',
  27. coerce=int,
  28. choices=[(0, 'down'), (1, 'up')])
  29. class SearchForm(Form):
  30. search = StringField(_('search'), validators=[DataRequired()])