Thank you Anthony,Very good discussion. Just one question regarding when you say we "have to create own register/profile"...Let's say my model is:#----------------------------------------------------------------------------------------------db.define_table("Education",Field("education_of", 'reference auth_user', widget=SQLFORM.widgets.options.widget, requires= IS_EMPTY_OR(IS_IN_DB(db,db.auth_user.id))),Field("Title", "string", label='Education Title', requires=IS_NOT_EMPTY(),default=None))#----------------------------------------------------------------------------------------------controller:
form = auth();form2 = SQLFORM(db.Education).process()if form2.accepted:db.Education.education_of.default = db.auth_user.idreturn dict(form=form, form2 = form2)#-------------------------------------------------------------------------------------------------------------------------
And in view we add the education as a folding or something:<div class="container"><button type="button" class="btn btn-info" data-toggle="collapse" data-target="#demo">Add Education</button><div id="demo" class="collapse">{{=form2}}</div></div>
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.
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.
if (db.auth_user.user_type == 'User'):
def after_registration(form):
if form.vars.user_type == 'User':
redirect(...)
etc.
I guess I can do this:But that kills all the style. Then I got to custom style it.
Anthony