I'm not sure that reference is going to work. The reference usually points 
to the "id". So:

db.define_table('customers', 
    Field('name'), 
    Field('age'), 
    format = '%(name)s' 
) 

db.define_table('purchases', 
    Field('customer_id', db.customers), 
    Field('cart') 
)

Then the query might be:

rows = 
db((db.purchases.id>0)&(db.purchases.customer_id==db.customers.id)).select()

The purchases table would need to look like:
(1, CD) 
(1, DVD)

Web2py automatically makes the first column in all tables an 
auto-incrementing field named "id".

Reply via email to