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("/")
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')
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)