I have a simple 1:N relation (I think its very common scenatio) as you can 
see below. Now how can I create a query form SQLFORM.grid  to show 
'customer_person' table but view company_name in 'company' column instead 
of ID? I tried to put this query to grid 'db_companies.id == 
db_persons.company ' (inner join), it worked nice but 'show' button from 
grid viewed the 'customers_company' and not the 'customers_person' table. 
Is there a way how to accomplish this using e.g. left join?


db_companies=db.define_table('customers_company',
                 Field('company_name','string'),
                 Field('city','string',label=T('Město')),
)

db.define_table('customers_person',
                 Field('company','reference customers_company', requires=
IS_IN_DB(db,"customers_company.id","customers_company.company_name")),
                 Field('firstname','string'),
                 Field('lastname','string'),
)

-- 

--- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to