Hm.. so you are saying that I should store the "has rated" with the
user, and not the comment?

On Apr 11, 11:08 am, Kenneth Lundström <[email protected]>
wrote:
> On 11.4.2011 18:59, Drise wrote:> How would I go by doing that?
>
> > On Apr 11, 10:42 am, pbreit<[email protected]>  wrote:
> >> I wasn't aware that validators could be used like that. Perhaps just query 
> >> the db?
>
> Hello,
>
> as pbreit commented validators can t be used like that. They are used
> when you are using forms, to validate that the data you have
> entered/selected complies to some rules.
>
> To check if a user has rated already you query the database and if no
> rows found the user can rate.
>
> rated = db(db.hasrated.user == request.args[0]).select()
>
> if len(rated) == 0:
>          #user can rate
>
> else:
>          #user already rated, can t rate anymore
>
> Is this enough?
>
> Kenneth

Reply via email to