Hi, I'm stuck so I think I'll ask some help, considering the ususal searches in this group and book don't help enough considering my beginner level. I'll try to summarize my problem: I'm writing an app to make quotes and invoice for my business which is repairing and making guitars.
db.define_table('guitar', Field('brand',type='string')) db.define_table('customer', Field('name',type='string'), Field('guitar_ref',type='list:reference guitar')) db.customer.guitar_ref.requires=IS_IN_DB(db,'guitar.id',multiple='True') db.define_table('invoice', Field('work_todo',type='text'), Field('customer_ref',type='reference customer'), Field('guitar_ref',type='reference guitar')) db.invoice.customer_ref.requires=IS_IN_DB(db,'customer.id') my_query=??? db.invoice.guitar_ref.requires=IS_IN_DB(db(my_query),'guitar.id') When filling an invoice with a pre-filled in customer_ref field, I'd like to have only the guitars this customer owns. I can't figure out how to write the query that looks for the guitars owned by the customer selected in the invoice. Until now, I always avoided writing queries and db(query) by using things like db.customer[db.invoice.customer_ref], but it seems like I can't nest it on 2 levels. Any help would be greatly appreciated ! -- 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.