def new_post_submission(user_id): """Submits the new post to the DB""" post_dict = process_post_form(request.form) if post_dict['title']: title = post_dict['title'] content = post_dict['content'] post = Post.add(title, content, user_id) tags = post_dict['tags'] post.update_tags(tags) return redirect(f'/users/{user_id}') else: flash('Your Post Must Have a Title and Content!') return redirect(f'/users/{user_id}/posts/new')
def post_add(): r = {} n_json = request.get_json() Post.add(n_json, r) return jsonify(r)