# main\forms.py
from flask.ext.wtf import Form
from wtforms import StringField, SubmitField
from flask.ext.pagedown.fields import PageDownField
class PostForm(Form):
article_title = StringField('title')
body = PageDownField('body')
submit = SubmitField('submmit')
It's right.
# main\views.py
from .forms import PostForm
@main.route('/post', methods=['GET', 'POST'])
@login_required
def post():
title = 'edit'
form = PostForm()
if form.validate_on_submit():
posts = Post( body=form.body.data,
author=current_user._get_current_object())
db.session.add(posts)
flash('commit')
return redirect(url_for('main.doc'))
return render_template('post.html', title=title, form=form)
here are my code:
That's Class define:
It's right.
here is html file:
I GOT A WRONG