Esempio n. 1
0
    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!'
Esempio n. 2
0
 def GET(self):
     user_raters = db_session.query(Raters).all()
     return render('raters.html', raters=user_raters)
Esempio n. 3
0
 def GET(self):
     movies = db_session.query(Movie).order_by(Movie.id.desc()).all()
     return render('index.html', movies=movies) 
Esempio n. 4
0
 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)
Esempio n. 5
0
def movie_prefs(person_id):
    return db_session.query(Rating, Movie)\
                     .filter(Rating.rater_id==person_id)\
                     .filter(Rating.movie_id==Movie.id).all()