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.id
    return 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>
    

We can make the education_of  as readable = False. So, it gets 
updated/inserted as auth_user.id

Do I still need to code up profile separately?  We can add other tables the 
same way. No?


On Monday, February 1, 2016 at 12:25:43 PM UTC-5, Anthony wrote:
>
> If there aren't too many fields, it might just be easiest to put them all 
> in auth_user and just make some conditionally readable/writable depending 
> on the type of user. Otherwise, you could create separate profile tables 
> and have them reference auth_user. In that case, you would have to create 
> your own register/profile actions, as web2py Auth won't handle the separate 
> tables for you.
>
> Finally, it might be possible for you to conditionally change the names of 
> the Auth tables based on user type: 
> http://web2py.com/books/default/chapter/29/09/access-control#Renaming-Auth-tables.
>  
> However, you would have to be able to identify the user type *prior* to 
> registration/login (e.g., based on some identifier in the URL), as the Auth 
> table names must be determined in order to process any Auth actions.
>
> Anthony
>
> On Monday, February 1, 2016 at 12:30:04 AM UTC-5, [email protected] 
> <javascript:> wrote:
>>
>>
>> Hello web2py community. I am a new user and I have to say, web2py saves 
>> the day by saving so much time over a full stack framework which requires 
>> so much work. Anyway, going to ask a question tothe community. How to 
>> custom create auth_user so instead of adding extra fields to the auth_user 
>> we can have multiple tables for the profile with various attributes. I am 
>> creating an application for gym membership and I need to have the user 
>> register based on their job, current address, prior fitness routines, 
>> current fitness routine, activities they are interested...etc. Put all in 
>> one tables with various fields seems make a table disproportionately long. 
>> Would be nice to split them to different tables and user can pick and 
>> choose which tables they like to fill up or they don't. 
>>
>

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