Here is an option.
In db.py
auth.settings.profile_onaccept = lambda form: after_profile(form)
in default.py
def after_profile():
#where ever I want to redirect to.
return locals()
On Wednesday, August 17, 2016 at 2:28:55 PM UTC-4, Anthony wrote:
>
> I wouldn't do a redirect -- that's just an unnecessary additional request
> every time that route is requested. Better to handle it in the user()
> function or alter the link in the navbar.
>
> Anthony
>
> On Wednesday, August 17, 2016 at 1:01:55 PM UTC-4, Jim S wrote:
>>
>> I took a different approach - instead of changing the URL, I updated
>> default.py here:
>>
>> def user():
>> """
>> exposes:
>> http://..../[app]/default/user/login
>> http://..../[app]/default/user/logout
>> http://..../[app]/default/user/register
>> http://..../[app]/default/user/profile
>> http://..../[app]/default/user/retrieve_password
>> http://..../[app]/default/user/change_password
>> use @auth.requires_login()
>> @auth.requires_membership('group name')
>> @auth.requires_permission('read','table name',record_id)
>> to decorate functions that need access control
>> """
>>
>>
>> if request.args[0] == 'profile':
>> for field in db.auth_user.fields:
>> db.auth_user[field].writable = False
>> db.auth_user[field].readable = False
>>
>>
>> db.auth_user.id.writable = True
>> db.auth_user.first_name.writable = True
>> db.auth_user.last_name.writable = True
>> db.auth_user.minimum_tons.writable = True
>>
>>
>> if request.args[0] == 'profile' then you'll be affecting the form
>> displayed. Or, maybe you could redirect from within this controller to the
>> actual page that you want.
>>
>> -Jim
>>
>>
>>
>>
>> On Wednesday, August 17, 2016 at 11:39:45 AM UTC-5, Steve Joe wrote:
>>>
>>> Please look at the attached image above. I want to go to page you/index
>>> upon clicking "Profile'.
>>>
>>> On Wednesday, August 17, 2016 at 6:26:16 PM UTC+5:30, Ron Chatterjee
>>> wrote:
>>>>
>>>> Can you elaborate the problem better? What exactly u trying to solve.
>>>> Give a url structure of before n after u want to see?
>>>
>>>
--
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.