You are the best Anthony! I did this:

auth.settings.register_onaccept = lambda form: after_registration(form) in 
my model 

in my controller worked fine.

Now all I want to do is append my menu with user profile (see attached). 
But user profile will have the same attributes like regular profile. Means 
if the user profile has already been created it will have all the inserted 
texts and user can modify/edit and then do "apply changes". Rather than 
having another link to "update profile". Wish you can point me somewhere . 
lol. 

Thank you for all the help! Appreciate it. 



On Tuesday, February 2, 2016 at 3:45:12 PM UTC-5, Anthony wrote:
>
> auth.register() automatically does a redirect after registration, so to do 
> your own redirect, you should either pass a callback as the onaccept 
> argument to auth.register() or specify the callback via 
> auth.settings.register_onaccept.
>
> Also, this condition:
>
> if (db.auth_user.user_type == 'User'):
>
> will not do what you want. Because db.auth_user.user_type is a Field 
> object, the above is simply a Query object (and since a Query object is not 
> falsey in Python, the above will always evaluate to True).
>
> Instead, assuming you use the onaccept callback, note that the 
> registration Form object gets passed to the callback, so you could do:
>
> def after_registration(form):
>     if form.vars.user_type == 'User':
>         redirect(...)
>     etc.
>
> Anthony
>

-- 
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