def profile(userid): return render_template("profile.html", current_user = session.get('user'), profile_user = userid, blogitems = database.getPostM("userid",userid), comments = database.getCommentsM("userid",userid));
def post(postid): if request.method == "GET": return render_template("/post.html", current_user = session.get('user'), blogitem = database.getPostM("_id",postid)[0], comments = database.getCommentsM("postid", postid)) else: if 'user' in session: database.addCommentM(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.getPostM("_id",postid)[0], comments = database.getComments("postid",postid), error = "You must be logged in to do that")