how do i explicitly update the auth.user.money? I thought that's what I did here "...{'money':auth.user.money+100}..."
On Sunday, 11 August 2013 17:54:14 UTC+1, Anthony wrote: > > Upon login, the auth.user object is stored in the session and is not > updated again until next login (i.e., updating the db.auth_user record does > not update auth.user). So, you'll have to explicitly update auth.user.money > as well. > > Anthony > > On Sunday, August 11, 2013 12:42:45 PM UTC-4, sasogeek wrote: >> >> in a function in default.py, i have this code >> >> #... >> if request.vars.uploader_id: >> uploaderid = request.vars.uploader_id >> uploader = db(db.auth_user.id==uploaderid).select() >> >> db(db.auth_user._id==uploaderid).update(**{'money':uploader[0].money+500}) >> db(db.auth_user._id==auth.user.id >> ).update(**{'money':auth.user.money+100}) >> db.auth_membership.insert(**{'group_id':uploaderid, 'user_id': >> auth.user.id}) >> redirect(URL()) >> money = auth.user.money >> #... >> >> return dict(..., money = money, ) >> >> in the view for this function, i have this code as well >> >> <form action='home'> >> <input type='hidden' name='uploader_id' >> value='{{=content.uploader_id}}'> >> <input type='submit'> >> </form> >> >> {{=money}} >> >> >> >> everything works just fine, the problem i have though is that, when the >> form is submitted, and the page reloads, {{=money}} doesn't update. it >> remains the same as before the page reloaded, but in the database, that >> value has changed. it only changes after i logout, and login again. even >> manually reloading the page doesn't change the value. How do I change that >> and let {{=money}} update after the form is submitted and the page reloads? >> and even a better option, can i make {{=money}} change without letting the >> whole page reload too? >> > -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.