Esempio n. 1
0
def edit_post_submission(post_id):
    """updates the specified post to use the newly submitted data"""

    post_dict = process_post_form(request.form)

    if post_dict:
        title = post_dict['title']
        content = post_dict['content']
        tags = post_dict['tags']

        Post.update_by_id(post_id, title, content, tags)
        return redirect(f'/posts/{post_id}')
    else:
        flash('Your Post Must Have a Title and Content!')
        return redirect(f'/posts/{post_id}/edit')