Re: [web2py] Re: update table from sqlform

2013-12-06 Thread Johann Spies
Are you using SQLFORM or SQLFORM.factory?

Regards
Johann

-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: update table from sqlform

2013-12-06 Thread Anthony
I don't think this is documented, but when dealing with a join, you have to 
specify the table in order to use .update_record(). So, it would be:

record.organization.update_record(**db.organization._filter_fields(form.vars
))

Anthony

On Thursday, December 5, 2013 6:50:33 AM UTC-5, Yebach wrote:

 Hello

 I am trying to update records in user profile from form

 I have two tables that need to be updated

 auth_user and organization

 record = db((db.auth_user.organization==db.organization.id)  (
 db.auth_user.id == uid)).select().first()

 if form.process().accepted:
 
 record.update_record(**db.organization._filter_fields(form.vars))


 I also tried the 
 https://groups.google.com/forum/#!topic/web2py/hpH7a3Qz3Wg but kind of 
 the same problem

 I am getting the following error
 type 'exceptions.KeyError' 'update_record'


 thank you in advance


-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: update table from sqlform

2013-12-05 Thread Yebach


Hello

 I am trying to update records in user profile from form

 I have two tables that need to be updated

 auth_user and organization

 record = db((db.auth_user.organization==db.organization.id)  (
 db.auth_user.id == uid)).select().first()

 if form.process().accepted:
 
 record.update_record(**db.organization._filter_fields(form.vars))


 I also tried the 
 https://groups.google.com/forum/#!topic/web2py/hpH7a3Qz3Wg but kind of 
 the same problem

 I am getting the following error
 type 'exceptions.KeyError' 'update_record'

 

 Doing some  experiments even if there is no error the update does not 
 happen. the table's fields in db are not updated


 thank you in advance


-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.