Beispiel #1
0
def edit2_post():
    if request.method == 'GET':
        return make_response(posts())
    else:
        title = request.form['title']
        content = request.form['content']
        _id = request.form['post_id']
        Post.edit_post(id=_id,
                       data={
                           'title': title,
                           'content': content,
                           'created_date': datetime.datetime.today()
                       })
        return make_response(posts())
def edit_post(_id, dic):
    """
    Edit a post
    kwargs is the attributes to edit
    return the id od the post
    """
    _id = Post.edit_post(_id, **dic)
    return _id