db.define_table('vendors',
Field('name','string'),
Field('vendor_location','string'),
format='%(name)s', migrate=True)
db.define_table('product',
Field('product_code','string'),
Field('product_name','string'),
Field('product_price','string'),
Field('product_owner', 'reference vendors'),
Field('description','text'),
Field('image','string', label='Image Path'),
#Field('product_picture', 'upload', uploadfield='product_picture_file'),
#Field('product_picture_file', 'blob'),
The problem is when I try to select the field it only shows me the id and not the name of the referenced record. I've seen a few of Anthony's post, but I can't seem to wrap my head around what's happening.
Here you'll see it returns the product_owner as 2L instead of the actual name of the owner. Is my format/representation messed up in my model?
In [1]: products = db(
db.product.id>0).select()
In [2]: products.first()
Out[2]: <Row {'product_owner': 2L, 'description': 'This is my product description', 'image': '../static/images/image2.png', 'id': 1L, 'product_price': '13.99', 'product_code': '0001', 'product_name': 'my great product'}>