Пример #1
0
def post_to_wall(username):
    model.connect_to_db()
    user_id = model.get_userid_by_name(username)
    wall_posts = model.get_wall_posts(user_id)
    author_id = model.get_userid_by_name(session.get("username"))
    wall_owner = username
    content = request.form.get("content")
    model.post_to_wall(wall_owner, author_id, content)
    return redirect(url_for("user_wall", username=username))
Пример #2
0
def post_to_wall(username):
    model.connect_to_db()
    user_id = model.get_userid_by_name(username)
    post_input = request.form.get("content")
    author_id = session['username']
    model.create_wall_post(user_id, author_id, post_input)
    return redirect(url_for("view_user", username=username))
Пример #3
0
def post_to_wall(username):
    model.connect_to_db()
    user_id = model.get_userid_by_name(username)
    post_input = request.form.get("content")
    author_id = session['username']
    model.create_wall_post(user_id, author_id, post_input)
    return redirect(url_for("view_user", username=username))
Пример #4
0
def user_wall(username):
    model.connect_to_db()
    user_id = model.get_userid_by_name(username)
    wall_posts = model.get_wall_posts(user_id)
    html = render_template("wall.html",
                           username=username,
                           wall_posts=wall_posts)
    return html
Пример #5
0
def view_user(username):
    model.connect_to_db()
    user_id = model.get_userid_by_name(username)
    wall_posts = model.get_wall_posts_by_user(user_id)
    return render_template("wall.html",
                           wall_posts=wall_posts,
                           username=username,
                           session=session)
Пример #6
0
def post_to_wall(username):
    owner_id = model.get_userid_by_name(username)
    print "OWNER_ID", owner_id
    author_id = session.get("user_id")
    wall_post = request.form.get("wall_post")
    print "AUTHOR ID", author_id
    print "WALL POST", wall_post
    model.submit_post(owner_id, author_id, wall_post)
    return redirect(url_for("show_user_profile", username=username))
Пример #7
0
def post_to_wall(username):
    owner_id = model.get_userid_by_name(username)
    print "OWNER_ID", owner_id
    author_id = session.get("user_id")
    wall_post = request.form.get("wall_post")
    print "AUTHOR ID", author_id
    print "WALL POST", wall_post
    model.submit_post(owner_id,author_id,wall_post)
    return redirect(url_for("show_user_profile", username=username))
Пример #8
0
def create_account():
    # Receive form from Register template
    model.connect_to_db()
    username = request.form.get("username")
    
    user_id = model.get_userid_by_name(username)
    if user_id == None:
        username = request.form.get("username")
        password = request.form.get("password")
        flash("Account successfully created. Please sign in below.")
        model.create_account(username, password)
        return redirect(url_for("index"))
    else:
        flash("User already exists.")
        return redirect(url_for("register"))
Пример #9
0
def create_account():
    # Receive form from Register template
    model.connect_to_db()
    username = request.form.get("username")

    user_id = model.get_userid_by_name(username)
    if user_id == None:
        username = request.form.get("username")
        password = request.form.get("password")
        flash("Account successfully created. Please sign in below.")
        model.create_account(username, password)
        return redirect(url_for("index"))
    else:
        flash("User already exists.")
        return redirect(url_for("register"))
Пример #10
0
def view_user(username):
    model.connect_to_db()
    user_id = model.get_userid_by_name(username)
    wall_posts = model.get_wall_posts_by_user(user_id)
    return render_template("wall.html", wall_posts = wall_posts, username = username, session = session)