def POST(self): i = web.input() check = db_session.query(Raters, Role, UserRole)\ .filter(Raters.name==i.username)\ .filter(UserRole.rater_id==Raters.id)\ .filter(UserRole.role_id==Role.id)\ .first() if check != None: web.ctx.session.username = i.username web.ctx.session.role = check.Role.role_name web.ctx.session.loggedIn = True return web.seeother('/dashboard') return 'something went awry!'
def GET(self): user_raters = db_session.query(Raters).all() return render('raters.html', raters=user_raters)
def GET(self): movies = db_session.query(Movie).order_by(Movie.id.desc()).all() return render('index.html', movies=movies)
def GET(self, id): user = db_session.query(Raters).filter(Raters.id==id).first().name user_movies = movie_prefs(id) return render('movies.html', user_movies=user_movies, user=user)
def movie_prefs(person_id): return db_session.query(Rating, Movie)\ .filter(Rating.rater_id==person_id)\ .filter(Rating.movie_id==Movie.id).all()