Hello. I'm trying to get a view to check if a user has already rated something (ie, is in the hasrated database). I have this code {{if ratings.username.IS_NOT_IN_DB(auth.user):}} But when the database is empty I get a Nonetype error. Then, when I manually add myself to the database, I get <type 'exceptions.AttributeError'>('str' object has no attribute 'IS_NOT_IN_DB'). Also, in my controller for the page that activates this, I have ratings = db(db.hasrated._id==request.args(0)).select().first()
My db is as follows: db.define_table('hasrated', Field('_id', db.comment), Field('username')) What I would like to have happen is to when they rate a comment, they are no longer allowed to rate it or allowed to rate it in the opposite direction, say if they change their mind. I'm relatively new to web2py, although I instantly fell in love with it as a web developer. Alas, that does limit the complexity of code I'm able to understand at the moment, although I'm very open to learning as long as its well explained as is the official book. Any ideas?