So, In my application. I have two user type. User and Tutor.
Once they register, if user_type = 'User', I want it to go through the
registration process and create a user_profile by redirecting to
"user_profile". If user_type = 'Tutor', create a tutor_profile and get
redirected
in my default controller, auth(): I have:
form = auth();
if form.accepted:
if request.args(0) in ['register']:
if (db.auth_user.user_type == 'User'):
redirect(URL('user_profile'))
else:
redirect(URL('teacher_profile'))
But this don't work. It register and gets redirected to index.
On Tuesday, February 2, 2016 at 10:32:34 AM UTC-5, Anthony wrote:
> On Monday, February 1, 2016 at 9:40:07 PM UTC-5, Ron Chatterjee wrote:
>>
>> Come to think Anthony, the best way to do it will be similar to this.
>> Having hidden field and tables and once selected the user_type, all the
>> other fields or tables shows up.
>>
>>
>> https://stackoverflow.com/questions/17380476/web2py-authenticating-two-types-of-profile
>>
>> But the implementation is wrong.
>>
>> hidden_fields = (user_extra_fields if request.args(1) == 'tutor')
>>
>> request.args(1) will never get satisfied like that. Need to process the
>> table and then set the argument. I am thinking...but I could be wrong.
>>
>>
> In that particular question, the premise was that the user type would be
> specified in the URL (in request.args(1)) -- so I believe the proposed
> implementation would work in that case. If you cannot determine user type
> until after login, then yes, you would need an alternative setup.
>
> 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.