Exemplo n.º 1
0
def process_login():
    email = request.form['email']
    password=request.form['password']
    user = model.user_by_email(email, password) #add get user by email to model
    if user:
        session['user'] = [user.email, user.password]
        flash("Successfully logged in")
        return redirect('/home_page')
    else:
        flash("Account not found.")
        return redirect("/")
Exemplo n.º 2
0
def rate_movie(id):
    #Add an if statement to see if they've rated it before so they
    #can't rate the same movie twice.
    stars=request.form['rating']
    print stars
    user=model.user_by_email(session['user'][0], session['user'][1])
    print user
    user_id=user.id
    print user_id
    movie_id=id
    print movie_id
    new_rating=model.Rating(rating=stars, movie_id=movie_id, user_id=user_id)
    print new_rating
    new_rating.add_rating()
    return redirect('/home_page')
Exemplo n.º 3
0
def home_page():
    user=model.user_by_email(session['user'][0], session['user'][1])
    user_id=user.id
    ratings=model.Session.query(model.Rating).filter_by(user_id=user_id).all()
    return render_template('home_page.html', ratings=ratings)