Advertisement
Deerenaros

wtforms

Dec 4th, 2014
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.60 KB | None | 0 0
  1. class PostForm(Form):
  2.     """
  3.     Object, that could be rendered into html with hidden tag placed in order to CLRF protection.
  4.     Contents post:
  5.         - title (string): post's title, represented by <input type=text />
  6.         - html (string): post's entry, represented by <textarea></textarea>
  7.     """
  8.     title = StringField("title", validators=[InputRequired()])
  9.     html = TextAreaField("html", validators=[InputRequired()])
  10. #   tags = StringField("tags", validators=[Regexp("[\w\s]*", message="Occasion arises while tried parse tag-list...")])
  11.  
  12.  
  13. class RegForm(Form):
  14.     """
  15.     Object, that could be rendered into html with hidden tag placed in order to CLRF protection.
  16.     Contents user reg. info:
  17.         - mail (string): user's e-mail, represented by <input type=text />
  18.         - pswd (string): user's password, represented by <input type=password />
  19.         - brth (string): user's birthsday, represented by <input type=text />
  20.         - about (string): user's additional info, represented by <textarea></textarea>
  21.     """
  22.     mail = StringField("mail", validators=[Email(), InputRequired()])
  23.     pswd = PasswordField("pswd", validators=[InputRequired()])
  24.     brth = DateField("brth", validators=[InputRequired()], format='%d/%m/%Y')
  25.     about = TextAreaField("about")
  26.  
  27.  
  28. class LoginForm(Form):
  29.     """
  30.     Object, that could be rendered into html with hidden tag placed in order to CLRF protection.
  31.     Sign in form:
  32.         - mail (string): user's e-mail, represented by <input type=text />
  33.         - pswd (string): user's pswd, represented by <input type=password />
  34.     """
  35.     mail = StringField("mail", validators=[InputRequired()])
  36.     pswd = StringField("pswd", validators=[InputRequired()])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement