[web2py] Re: Could I use SQLFORM.factory to update 2 tables in a single form

2017-04-24 Thread Rudy
Hi Massimo, I tried below, it could populate database values into the UPDATE FORM and updated the 2 tables correctly, not sure if it's the best way to do it. Any comment is appreciated, thanks again! item_id = request.args(0) item_row = db.item(item_id) quote_row = db.quotation(item

[web2py] Re: Could I use SQLFORM.factory to update 2 tables in a single form

2017-04-23 Thread Rudy
Hi Massimo, Thanks for your help, i indeed used db.item.insert(**db.item._filter_fields(form.vars)) and db.subscription_item.insert(**db.subscription_item._filter_fields(form.vars)) to generate a CREATE FORM in a separate action. Now I want to create another action with an UPDATE FORM for user

[web2py] Re: Could I use SQLFORM.factory to update 2 tables in a single form

2017-04-21 Thread Massimo Di Pierro
You can do form = SQLFORM.factory(db.item, db.subscription_item) as long the two tables do not have fields with the same name. Then after if form.process().accepted: db.item.insert() db.subscription_item.insert() where ... should be replaced by the proper fields in form.vars On