forked from kkris/refer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
forms.py
26 lines (21 loc) · 1.03 KB
/
forms.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env python
# from flaskext.wtf import Form, TextField, PasswordField, TextAreaField, \
# HiddenField, Required
# from flaskext.wtf import validators
from flask_wtf import FlaskForm as Form
from wtforms import TextField, PasswordField, TextAreaField, \
HiddenField, validators
from wtforms.validators import Required
class LoginForm(Form):
username = TextField('username', validators=[Required()])
password = PasswordField('password', validators=[Required()])
class PostForm(Form):
title = TextField('title', validators=[Required()])
post = TextAreaField('post', validators=[Required()])
tags = TextField('tags', validators=[Required()])
class CommentForm(Form):
author = TextField('name', validators=[Required()])
email = TextField('email (not visible to others)',
validators=[Required(), validators.email()])
comment = TextAreaField('comment',
validators=[Required(), validators.Length(2, 500)])