[web2py] Re: Update on multiple tables with one form

2013-12-27 Thread Matheus Cardoso
I've tried the Anthony's idea and it worked, with one difference, though: the id could not be any value. It just worked putting the id with the same value of request.arg(0). I think that has some relation with the hidden input in custom forms where you have to put the id of the instance that are

[web2py] Re: Update on multiple tables with one form

2013-12-26 Thread Matheus Cardoso
Hi guys, sorry about reopen this conversation, but I got stuck in a similar situation. My code is almost equal to Annet's code, except that I'm using a custom form and I have to pass session=None and formname to form.process(). However, I have a field that has to be unique. So, form.process() do

Re: [web2py] Re: Update on multiple tables with one form

2013-01-29 Thread Annet
Hi Angelo, I am glad you solved your problem. I found a way to add automatically variables to form.vars, hope this helps! > > record = db(...).select().first() > > for table in [db.table1, db.table2]: > for field in table.fields: > form.vars[field] = record[table][fiel

Re: [web2py] Re: Update on multiple tables with one form

2013-01-29 Thread Angelo Compagnucci
To Massimo, I think this should be in the book after this http://web2py.com/books/default/chapter/29/07#One-form-for-multiple-tables Thanks! 2013/1/29 Angelo Compagnucci > Hi Annet! > > This is freaking awesome and it worked like a charm! > > I found a way to add automatically variables to fo

Re: [web2py] Re: Update on multiple tables with one form

2013-01-29 Thread Angelo Compagnucci
Hi Annet! This is freaking awesome and it worked like a charm! I found a way to add automatically variables to form.vars, hope this helps! record = db(...).select().first() for table in [db.table1, db.table2]: for field in table.fields: form.vars[field] = record[tabl

[web2py] Re: Update on multiple tables with one form

2013-01-29 Thread Annet
I solved a similar problem the following way: # retrieve records node=db(db.node.id==id).select(db.node.ALL).first() address=db(db.address.nodeID==id).select(db.address.ALL).first() telecom=db(db.telecom.nodeID==id).select(db.telecom.ALL).first() # build form form=SQLFORM.factory(db.node,db.addre