Any help on this would be appreciated...
For my app, when a user saves their Profile, I want them to stay on Profile, with at response.flash = T("Profile SAVED.") message at top. I have it all working, but the message is displayed when the user clicks on nav bar Profile AND when they press the save button. How do I get the message to ONLY flash, when they press Save button. I don't know how to sense the two conditions, since URL is the same for both. Thanks! Rob Details here: Just create a NEW simple app, and I added the code as shown below. In Default.py 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': response.flash = T("Profile SAVED.") return dict(form=auth()) In db.py ## configure auth policy auth.settings.registration_requires_verification = False auth.settings.registration_requires_approval = False auth.settings.reset_password_requires_verification = True # - - - - - - - - - - - - - - - - - - # RAM START # Solution: how to have a user redirected to a page AFTER login # in this example, the URL('user/profile') will be used. # app name: AuthRedirect <- just a NEW application, with no modication # web2py Version 2.2.1 (2012-10-21 16:57:04) stable # - - - - - # in layout view, modify the line: # <ul id="navbar" class="nav pull-right">{{='auth' in globals() and auth.navbar(mode="dropdown") or ''}}</ul> # to # <ul id="navbar" class="nav pull-right">{{='auth' in globals() and auth.navbar(mode="dropdown",referrer_actions=None) or ''}}</ul> # this will cause the URL not to display # http://127.0.0.1:8000/AuthRedirect/default/user/login?_next=/AuthRedirect/default/index # but rather # http://127.0.0.1:8000/AuthRedirect/default/user/ # - - - - - # two lines of CODE BELOW placed in : # /models/db.py - located BELOW the setting under > ## configure auth policy lines auth.settings.login_next = URL('user/profile') # uncomment, and change the URL() if you want user to go to a URL after saving profile auth.settings.profile_next = URL('user/profile') # RAM END - - - - - - - - - - - - - In layout.html <ul id="navbar" class="nav pull-right">{{='auth' in globals() and auth. navbar(mode="dropdown",referrer_actions=None) or ''}}</ul> --