Exemplo n.º 1
0
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)
Exemplo n.º 2
0
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)
Exemplo n.º 3
0
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"))
Exemplo n.º 4
0
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"))
Exemplo n.º 5
0
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)
Exemplo n.º 6
0
Arquivo: app.py Projeto: snady/blag
def home():
        if usersession() == "":
                return redirect("/login")
        all_rows = utils.getAllPosts()
        return render_template("home.html", all_rows=all_rows)
Exemplo n.º 7
0
Arquivo: app.py Projeto: ldalynyc/blag
def home():
        if usersession() == "":
                return redirect("/login")
        all_rows = utils.getAllPosts()
        return render_template("home.html", all_rows=all_rows)