[web2py] Re: user profile fields for referenced table

2013-12-05 Thread 黄祥
if you had already logged in, you can retrieve current user logged in id using : auth.user_id after that just query it. e.g. rows = db(db.auth_user.id == auth.user_id).select().first() best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) -

[web2py] Re: user profile fields for referenced table

2013-12-04 Thread Yebach
So based on your answers I menaged to do my form The next question or problem I have is following. When user registers a new record is created in two tables (auth_user and organization). But when the user goes to profile page the form is empty and after filling it a new record is inserted in

[web2py] Re: user profile fields for referenced table

2013-12-03 Thread 黄祥
i think you shouldn't define the auth_user table, just keep it default, and if you want to add the new field of auth_user table, please use extra_fields. e.g. # append fields : auth.signature db._common_fields.append(auth.signature) # custom auth user table add fields gender, address, zip_code,

[web2py] Re: user profile fields for referenced table

2013-12-03 Thread Yebach
I left the default auth.create_table(migrate = setting.migrate) then added extra fields then deffined my table organization in user profile only first name, last name and email are shown where am I going wrong? On Tuesday, December 3, 2013 11:14:45 AM UTC+1, 黄祥 wrote: i think you shouldn't

[web2py] Re: user profile fields for referenced table

2013-12-03 Thread Yebach
I meanaged to add fileds, but insted of being the fileds of referenced table they were added to auth_user table all of them of type integer I want them to be read from table organization code in db.py auth.settings.extra_fields['auth_user']= [ Field('o_name','reference

[web2py] Re: user profile fields for referenced table

2013-12-03 Thread 黄祥
i'm so sorry, didn't realize it, i think is it all about sequential, please define the organization table first and then auth.settings.extra_fields, auth.define_tables, custom_auth_table (for field constructor : label, required, requires, etc). e.g. # 1st db.define_table('organization', )

[web2py] Re: user profile fields for referenced table

2013-12-03 Thread 黄祥
1 more thing, if you have reference field to another table it will refer to the table id of your target, so i think it's useless if you define a lot of auth user extra field to just 1 table, because it will return 1 value which is the table id, in this case will be organization id. best

[web2py] Re: user profile fields for referenced table

2013-12-03 Thread Yebach
So how do i resolve that I have aut_user table that has a field organization (id) In table organization I have more fields (org name, adress, etc) Now I want to show this fields (almost all) of table organization to user in user profile view. ?? On Tuesday, December 3, 2013 1:34:06 PM

[web2py] Re: user profile fields for referenced table

2013-12-03 Thread 黄祥
i think it will make the database table denormalization (make data redundancy) if you put almost all of your organization table value to your auth_user table. i think just refer the organization from auth_user table is more than enough, and if you want to know this user belong to which

[web2py] Re: user profile fields for referenced table

2013-12-03 Thread Yebach
where do you put he query db.auth_user.branch_adress? On Tuesday, December 3, 2013 1:54:57 PM UTC+1, 黄祥 wrote: i think it will make the database table denormalization (make data redundancy) if you put almost all of your organization table value to your auth_user table. i think just

[web2py] Re: user profile fields for referenced table

2013-12-03 Thread Yebach
where do you put he query db.auth_user.branch_adress? I want the user to add company, not to choose from avaliable companies, but the data is inserted into organization table On Tuesday, December 3, 2013 1:54:57 PM UTC+1, 黄祥 wrote: i think it will make the database table denormalization

[web2py] Re: user profile fields for referenced table

2013-12-03 Thread Anthony
Have a look at http://web2py.com/books/default/chapter/29/07/forms-and-validators#One-form-for-multiple-tables . Anthony On Tuesday, December 3, 2013 7:37:34 AM UTC-5, Yebach wrote: So how do i resolve that I have aut_user table that has a field organization (id) In table organization I

[web2py] Re: user profile fields for referenced table

2013-12-03 Thread 黄祥
where do you put he query db.auth_user.branch_adress? db.auth_user.branch.address not db.auth_user.branch_adress db.table.reference_table_field_from_table.field_of_reference_table it depend where i want to receive the query db.auth_user.branch.address result, e.g. if i want the result in