def edit(post_id): if request.method =='POST': post_manager.edit_post(post_id, request.form) return redirect(url_for('read' ,post_id = post_id)) else: post = post_manager.get_post_by(post_id) return render_template('edit.html', post = post)
def delete(post_id): post = post_manager.get_post_by(post_id) if session['user_id'] == post.user_id: post_manager.del_post(post_id) else: pass # error message, error.html / alert return redirect(url_for('posts', wall_id =session['wall_id']))
def read(post_id): post = post_manager.get_post_by(post_id) return render_template('read.html', post = post)