[web2py] Re: save the original value of one field in another table field

2018-06-20 Thread Anthony
On Wednesday, June 20, 2018 at 9:16:04 AM UTC-4, Ayron Rangel wrote: > > Anthony, > > What I want would be to insert the same value(integer) from one Field to > another Field on other table. > Ex.: > > db.define_table('product', > Field('name', 'string'), > Field('qtd', 'integer', default

[web2py] Re: save the original value of one field in another table field

2018-06-20 Thread Ayron Rangel
Anthony, What I want would be to insert the same value(integer) from one Field to another Field on other table. Ex.: db.define_table('product', Field('name', 'string'), Field('qtd', 'integer', default=1, readable=False, writable=False), Field('stock_id', db.stock) ) db.define_table

[web2py] Re: save the original value of one field in another table field

2018-06-19 Thread Anthony
This is generally not good database design. What are you really trying to do? Would it make more sense for mytable2 to reference mytable? Anthony On Tuesday, June 19, 2018 at 9:09:42 PM UTC-4, Ayron Rangel wrote: > > How can i save the value of one field in another table field?? > > db.define_ta

[web2py] Re: save the original value of one field in another table field

2018-06-19 Thread 黄祥
perhaps you can use database callbacks or form validation *ref:* http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#callbacks-on-record-insert--delete-and-update http://web2py.com/books/default/chapter/29/07/forms-and-validators#onvalidation best regards, stifan -- Reso