Beispiel #1
0
def post():
    form = PostForm(request.form)
    if request.method == 'POST' and form.validate():
        title = form.title.data
        content = form.content.data
        due_date = form.due_date.data
        posts = Post(title, content, due_date)
        posts.add_post()
        return redirect(url_for('app.todohome'))
    return render_template('post.html', form=form)
Beispiel #2
0
def post(page_id):
    form = PostForm(request.form)
    page_id = page_id
    if request.method == 'POST' and form.validate():
        content = form.content.data
        username = form.username.data
        page_id = form.page_id.data
        time = datetime.datetime.now()
        post = Post(content, username, time, page_id)
        post.add_post()
        flash('新しく投稿しました!')
        return redirect(url_for('app.user_page'))
    return render_template('post.html', form=form, page_id=page_id)