Also, note that if you use auth.profile() instead of constructing your own 
update form, auth.user will get updated as well, so you might consider 
switching to auth.profile().

Anthony

On Saturday, June 22, 2013 10:30:04 AM UTC-4, Anthony wrote:
>
> auth.user is just a reference to session.auth.user. Once you log in, 
> session.auth.user does not change throughout the session, so if you update 
> the user record in the database, that will not affect auth.user. If you 
> want to update auth.user as well, you have to do so manually. One option 
> might be to add an ._after_update callback to the db.auth_user table (maybe 
> we should add this as an option to Auth so it happens automatically).
>
> Anthony
>
> On Saturday, June 22, 2013 10:06:31 AM UTC-4, lesssugar wrote:
>>
>> I'm trying to update first_name and last_name of auth_user table. The 
>> update form works ok, the respective user record gets updated but the 
>> {{=auth.user.first_name}} and {{=auth.user.last_name}} remain unchanged in 
>> the view. Guess it's a cache issue but not sure how to make my way around 
>> it.
>>
>> controller:
>>
>> db.auth_user.email.writable = db.auth_user.email.readable = False
>> db.auth_user.password.writable = db.auth_user.password.readable = False
>>
>> edit_fullname = crud.update(db.auth_user, request.args(0), 
>> deletable=False, next=(URL('seafarer', 'profile')), _class='formstyle')
>>
>> return dict(edit_fullname=edit_fullname)
>>
>> the form is just this
>>
>> {{extend 'layout.html'}}
>> {{=edit_fullname}}
>>
>> respective view line
>>
>> <li id="full_name"><h1>{{=auth.user.first_name}} 
>> {{=auth.user.last_name}}</h1></li>
>>
>>
>>
>>
>>

-- 

--- 
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/groups/opt_out.


Reply via email to