[web2py] Re: paired fields in web2py
You can use SQLFORM.factory but I recommend something like vue, ractive, or angular. In in the end it makes things simpler. On Monday, 7 August 2017 01:01:05 UTC-5, Mumtoz Dalimov wrote: > > Thanks a lot, Massimo. > I understood the structure of the model. > > Any ideas how to make convenient input of data in the View. > Should inputter remember invoice.id each time he inputs invoice_item to > get invoice_items grouped? > Maybe I better use SQLFORM.factory to get 2 tables populated at once? And > how then get one list field (QUANTITY) multiplied when another(PRODUCT) is > multiplied? > > > -- 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/d/optout.
[web2py] Re: paired fields in web2py
Thanks a lot, Massimo. I understood the structure of the model. Any ideas how to make convenient input of data in the View. Should inputter remember invoice.id each time he inputs invoice_item to get invoice_items grouped? Maybe I better use SQLFORM.factory to get 2 tables populated at once? And how then get one list field multiplied when another is multiplied? -- 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/d/optout.
[web2py] Re: paired fields in web2py
I would do db.define_table('customer',Field('name')) db.define_table('product',Field('name')) db.define_table('invoice',Field('customer','reference customer')) db.define_table('invoice_item',Field('invoice','reference invoice'),Field(product','reference product'),Field('quantity','integer')) customer = db.customer(name="Pinco Pallino") for invoice in db(db.invoice.customer == customer.id).select(): print invoice.id items = db(db.invoice_item.product==db.product.id)(db.invoice_item.invoice==invoice.id).select() print items On Friday, 4 August 2017 09:45:51 UTC-5, Mumtoz Dalimov wrote: > > Hello, > > Is it possible to create table with 2 fields for example, list:reference > , which are being multiplied pairly. > How to input this kind of info in one record of table > > Customer>Bob > Product:BookAmount:20 > Product:Pencil Amount:39 > > Customer>John > Product:PenAmount:7 > Product:Pencil Amount:39 > Product:Backpack Amount:1 > > I am very new in coding and web2py, so need your help > Thanks > -- 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/d/optout.