Ejemplo n.º 1
0
def update_post(post_id):
    title = request.form.get("title")
    content = request.form.get("content")

    post = PostService.update_post(post_id, {"title": title, "content": content})

    return jsonify_with_data(APIError.OK)
Ejemplo n.º 2
0
def update_post(post_id):
    title = request.form.get('title')
    content = request.form.get('content')

    post = PostService.update_post(post_id, {
        'title': title,
        'content': content
    })

    return jsonify_with_data(APIError.OK)
Ejemplo n.º 3
0
def update_post(id):
    post = PostService.get_one(id)

    form = PostForm(title=post.get('title'), content=post.get('content'))
    if request.method == "GET":
        return render_template('admin/update_post.html', form=form)

    title = request.form['title']
    content = request.form['content']

    try:
        post = PostService.update_post(id, {'title': title, 'content': content})
        flash(u'文章编辑成功')
    except:
        flash(u'文章编辑失败,请与管理员联系')

    return render_template('admin/show_posts.html')
Ejemplo n.º 4
0
def update_post(id):
    post = PostService.get_one(id)

    form = PostForm(title=post.get('title'), content=post.get('content'))
    if request.method == "GET":
        return render_template('admin/update_post.html', form=form)

    title = request.form['title']
    content = request.form['content']

    try:
        post = PostService.update_post(id, {
            'title': title,
            'content': content
        })
        flash(u'文章编辑成功')
    except:
        flash(u'文章编辑失败,请与管理员联系')

    return render_template('admin/show_posts.html')