Thanks, not only does it work, but now I also understand exactly why it 
works:) Thanks again!

W dniu niedziela, 25 maja 2014 15:45:02 UTC+2 użytkownik Anthony napisał:
>
> You are changing the value in the Row object but not updating the actual 
> record in the database. To do so, after updating the Row, you can call 
> user.update_record(). Or if you only need to update the database (but not 
> the Row), you can just do user.update_record(registration_key=''). 
> Actually, if you don't need the user record for anything in the view, you 
> can avoid the select altogether, and just do the update:
>
> def show_reader():
>     form=FORM(INPUT(_type='submit'))
>     if form.accepts(request, session):
>         response.flash = 'Użytkownik został aktywowany'
>         db(db.auth_user.id == request.args(0, cast=int)).update(
> registration_key='')
>     return locals()
>
> Anthony
>
> On Sunday, May 25, 2014 8:45:56 AM UTC-4, john smith wrote:
>>
>> I set my app to require registration approval and cannot set the 
>> registration_key programmatically. I can set it through appadmin interface. 
>> Here is my code:
>> @auth.requires_membership('librarian')
>> def show_reader():
>>     user = db.auth_user(request.args(0, cast=int))
>>     form=FORM(INPUT(_type='submit'))
>>     if form.accepts(request,session):
>>         response.flash = 'Użytkownik został aktywowany'
>>         user.registration_key=''
>>     return locals()
>>
>> form is visible only if registration_key is set to 'pending'. When I 
>> click submit it seems to work because the form disappears(and if i print 
>> registration key in view i get empty string), but when i refresh the page 
>> the button is back and appadmin shows that registration key is set to 
>> 'pending'. Is there something I'm missing?
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to