-
Notifications
You must be signed in to change notification settings - Fork 0
/
forms.py
30 lines (24 loc) · 1.21 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
27
28
from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField, PasswordField
from wtforms.validators import DataRequired, URL
from flask_ckeditor import CKEditorField
##WTForm
class CreatePostForm(FlaskForm):
title = StringField("Blog Post Title", validators=[DataRequired()])
subtitle = StringField("Subtitle", validators=[DataRequired()])
img_url = StringField("Blog Image URL", validators=[DataRequired(), URL()])
author = StringField("Author of Post", validators=[DataRequired()])
body = CKEditorField("Blog Content", validators=[DataRequired()])
submit = SubmitField("Submit Post")
class RegisterForm(FlaskForm):
email = StringField('Email Address', validators=[DataRequired()])
password = PasswordField('Password', validators=[DataRequired()])
name = StringField("Name", validators=[DataRequired()])
submit = SubmitField('Submit')
class LoginForm(FlaskForm):
email = StringField('Email Address', validators=[DataRequired()])
password = PasswordField('Password', validators=[DataRequired()])
submit = SubmitField('Login')
class CommentForm(FlaskForm):
comment = CKEditorField("Comment", validators=[DataRequired()])
submit = SubmitField('Submit Comment')