Exemple #1
0
def postnew():
    if session["logged_in"] == False:
        return redirect("/index")
    if request.method == "GET":
        return render_template("postnew.html", username=session["user"], s=session)
    if request.method == "POST":
        postButton = request.form["postButton"]
        uname = session["user"]
        time = datetime.datetime.strftime(datetime.datetime.now(), "%Y-%m-%d %H:%M:%S")
        msg = request.form["post"]
        utils.addPost(uname, time, msg)
        posts = utils.getPosts()
        return redirect("/posts")  # render_template("posts.html", username = currentUser, posts = posts, comments = [])
Exemple #2
0
def postnew():
    if session['logged_in'] == False:
        return redirect('/index')
    if request.method=="GET":
        return render_template("postnew.html", username = session['user'])
    if request.method=="POST":
        postButton = request.form['postButton']
        uname = session['user']
        time = datetime.datetime.strftime(datetime.datetime.now(), '%Y-%m-%d %H:%M:%S')
        msg = request.form['post']
        utils.addPost(uname, time, msg)
        posts = utils.getPosts()
        return redirect("/posts") #render_template("posts.html", username = currentUser, posts = posts, comments = [])
def feed(username):
    print(request.method == "POST")
    if request.method == "POST":
        print("5")
        if(str(request.form["post"]) == "posted"):
            print("2")
            utils.addPost(username, str(request.form["title"]), "sub", str(request.form["paragraph_text"]))
        elif (str(request.form["post"])) == "finding":
            print(str(request.form["search_for"]))
            print("3")
            utils.addFriend(username, str(request.form["search_for"]))
            print(utils.isFriend(username, str(request.form["search_for"])))
        elif (str(request.form["post"])) == "commenting":
            utils.addComment(str(request.form["id"]), username, str(request.form["comments"]))
    return render_template("feed.html", comments = utils.showAllComments(), username = username, compareto = username,  posts = utils.showPosts(username), name = utils.findName(username), info = utils.showInfo(username), friendslist = utils.friendList(username))
Exemple #4
0
def feed(username):
    print(request.method == "POST")
    if request.method == "POST":
        print("5")
        if(str(request.form["post"]) == "posted"):
            print("2")
            utils.addPost(username, str(request.form["title"]), "sub", str(request.form["paragraph_text"]))
        elif (str(request.form["post"])) == "finding":
            print(str(request.form["search_for"]))
            print("3")
            utils.addFriend(username, str(request.form["search_for"]))
            print(utils.isFriend(username, str(request.form["search_for"])))
        elif (str(request.form["post"])) == "commenting":
            utils.addComment(str(request.form["id"]), username, str(request.form["comments"]))
    return render_template("feed.html", comments = utils.showAllComments(), username = username, compareto = username,  posts = utils.showPosts(username), name = utils.findName(username), info = utils.showInfo(username), friendslist = utils.friendList(username))
Exemple #5
0
def postnew():
    if session['logged_in'] == False:
        return redirect('/index')
    if request.method == "GET":
        return render_template("postnew.html", username=session['user'])
    if request.method == "POST":
        postButton = request.form['postButton']
        uname = session['user']
        time = datetime.datetime.strftime(datetime.datetime.now(),
                                          '%Y-%m-%d %H:%M:%S')
        msg = request.form['post']
        utils.addPost(uname, time, msg)
        posts = utils.getPosts()
        return redirect(
            "/posts"
        )  #render_template("posts.html", username = currentUser, posts = posts, comments = [])