def read(pid,wall_id): if request.method=="POST": post=user_manager.get_post(pid) comments=request.form['comments'] user_manager.comment(session['user_id'],comments,pid) return render_template('read.html',post=post,comments=post.comments) else: user=user_manager.get_user(wall_id) post=user_manager.get_post(pid) session['pid']=pid session['wall_id']=wall_id return render_template('read.html',post=post,comments=post.comments)
def modify(pid): if request.method=="POST": text=request.form['post'] user_manager.modify(pid,text) return redirect(url_for('read',pid=session['pid'],wall_id=session['wall_id'])) else: post=user_manager.get_post(pid) return render_template('edit.html',post=post)
def revise(id): check_id = user_manager.get_post(id) if check_id.user_id == session['user_id']: return render_template('post_revise.html', check_id = check_id) else: alert = "you can't revise!" return render_template("cannot_delete.html", alert = alert)
def delete(id): check_id = user_manager.get_post(id) if check_id.user_id == session['user_id']: user_manager.delete_contents_body(id) return redirect(url_for('contents', wall_id = check_id.wall_id)) else: alert = "you can't delete!" return render_template("cannot_delete.html", alert = alert)
def read(wall_id, id): check_post = user_manager.get_post(id) session['post_id'] = id comment_lists = check_post.comments return render_template('read.html', check_post = check_post, comment_lists = comment_lists)