def post(postid): if request.method == "GET": return render_template("/post.html", current_user=session.get('user'), blogitem=database.getPost("postid", postid)[0], comments=database.getComments("postid", postid)) else: if 'user' in session: database.addComment(request.form.get("comment_text"), postid, session['user']) return redirect("/post/" + postid) else: return render_template("/post.html", current_user=session.get('user'), blogitem=database.getPost("postid", postid)[0], comments=database.getComments( "postid", postid), error="You must be logged in to do that")
def post(post_title): posts = database.getPost(post_title) comment_button = request.args.get("comment_button",None) if comment_button == None: comments = database.getComments(post_title) return render_template("post.html", post_title=post_title, posts=posts,comments=comments) else: newComment = request.args.get("comment",None) database.insert('comments',post_title,newComment) comments = database.getComments(post_title) return render_template("post.html", post_title=post_title, posts=posts,comments=comments)
def post(postid): if request.method == "GET": return render_template("/post.html", current_user=session.get('user'), blogitem=database.getPost("postid", postid)[0], comments=database.getComments("postid", postid)) else: if 'user' in session: database.addComment(request.form.get( "comment_text"), postid, session['user']) return redirect("/post/" + postid) else: return render_template("/post.html", current_user=session.get('user'), blogitem=database.getPost("postid", postid)[0], comments=database.getComments("postid", postid), error="You must be logged in to do that")
def profile(userid): return render_template("profile.html", current_user=session.get('user'), profile_user=userid, blogitems=database.getPost("userid", userid), comments=database.getComments("userid", userid))
def profile(userid): return render_template("profile.html", current_user = session.get('user'), profile_user = userid, blogitems = database.getPost("userid",userid), comments = database.getComments("userid",userid));