[web2py] Re: How to limit user votes

2013-05-17 Thread Anthony
You'll have to be a little more specific than "doesn't work." What happens? What have you done to diagnose the problem? Does the ajax call get made properly? Etc. #model > db.define_table('content', > Field('username'), > Field('text', 'text'), > Field('file', 'upload'), > Field(

[web2py] Re: How to limit user votes

2013-05-17 Thread Christian Foster Howes
your code never writes the updated votes string. and i'm not sure that using the "in" operator on a string like that will give you the results that you want. you probably want another table say votelog db.define_table('voetlog', Field('content_id', 'reference content'), Field('user_id', 'r

[web2py] Re: How to limit user votes

2013-05-16 Thread sasogeek
can you give me an example code? here's what i have but doesn't work. #model db.define_table('content', Field('username'), Field('text', 'text'), Field('file', 'upload'), Field('userpic'), Field('time', 'datetime', update=request.now), Field('userid', readable=False), Fi

[web2py] Re: How to limit user votes

2013-05-15 Thread Niphlod
either you update the session with a counter and forbid voting if that variable is > some limit (but as soon as the session is erased (e.g. a clean cookie operation) the user will be able to vote again) or you build up on request.env.remote_addr (that is the ip address requesting the page) some

[web2py] Re: How to limit user votes

2013-05-15 Thread Anthony
Actually, as long as you are requiring users to register and log in, you might as well just associate each vote with a user ID -- then when a user votes, you can just check whether that same user has already voted. Anthony On Wednesday, May 15, 2013 10:10:44 AM UTC-4, sasogeek wrote: > > the bo