def lost(): if request.method=="GET": lostPosts = utils.getAllPosts("lost")[::-1] else: t = request.form['q'] lostPosts = utils.getTagPosts('lost',t)[::-1] return render_template("lost.html", lostPosts=lostPosts)
def found(): if request.method=="GET": foundPosts = utils.getAllPosts("found")[::-1] return render_template("found.html", foundPosts=foundPosts) else: t = request.form['q'] foundPosts = utils.getTagPosts('lost',t)[::-1] return render_template("found.html", foundPosts=foundPosts)
def blog(): if request.method=="GET": if 'un' not in session or session['un']==0: return redirect(url_for("home")) else: user = session['un'] s = "" stories = utils.getAllPosts() for p in stories: s += "<br>" s += "<div class='boxed2 type center'>" s += "<h1> <a href='story/%s'> %s</a> </h1>" %(p[1], p[1]) s += "<h2> Posted by: %s </h2>" %p[0] s += "<h3> %s </h3>" %p[2] + "</div><br>" s = Markup(s) return render_template("blog.html",un=user,stories=s) else: ti = request.form["title"] con = request.form["post_content"] utils.Post(session['un'],ti,con) return redirect(url_for("blog"))
def blog(): if request.method == "GET": if 'un' not in session or session['un'] == 0: return redirect(url_for("home")) else: user = session['un'] s = "" stories = utils.getAllPosts() for p in stories: s += "<br>" s += "<div class='boxed2 type center'>" s += "<h1> <a href='story/%s'> %s</a> </h1>" % (p[1], p[1]) s += "<h2> Posted by: %s </h2>" % p[0] s += "<h3> %s </h3>" % p[2] + "</div><br>" s = Markup(s) return render_template("blog.html", un=user, stories=s) else: ti = request.form["title"] con = request.form["post_content"] utils.Post(session['un'], ti, con) return redirect(url_for("blog"))
def index(): posts = utils.getAllPosts(); if 'username' in session: return render_template("index.html",username = session["username"],posts=posts) else: return render_template("index.html",posts=posts)
def home(): if usersession() == "": return redirect("/login") all_rows = utils.getAllPosts() return render_template("home.html", all_rows=all_rows)