forked from sixu05202004/flaskblog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathform.py
30 lines (24 loc) · 947 Bytes
/
form.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
27
28
29
30
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
"""
form.py
~~~~~~~~~~~
comment form
:copyright: (c) 2013.
:license: BSD, see LICENSE for more details.
"""
from flask.ext.wtf import Form, RecaptchaField
from wtforms import SubmitField, TextField, TextAreaField
from wtforms.validators import InputRequired, Email, Length
class CommentForm(Form):
author_name = TextField(
u'Name', validators=[InputRequired(message=u"Need an name"), Length(max=50)])
author_email = TextField(u"Email", validators=[
InputRequired(message=u"Need an email address"),
Email(message=u"Need a valid email address")])
author_url = TextField(u"Url")
content = TextAreaField(u"Content")
post_id = TextField()
recaptcha = RecaptchaField(u"Copy the words appearing below")
submit = SubmitField(u"Save")