You can do it: db.tblvehicles.Model.represent = Lambda value,row: value.MakeID.Make
but unless you denormalize this is slow (two nested select per row). On Tuesday, 7 January 2014 22:02:18 UTC-6, MVolpes wrote: > > Hi > > I have been using this framework for the last few days and I am in awe a > fantastic framework. I have come from a strong .net and php framework back > ground and wanted to learn python this has already taught me so much!! > > I have a question that hopefully can be answered easily and maybe I am > overlooking something. > > I have the smart grid working well however i want to display a reference > of a reference eg > > Vehicle > Model > Make > > > > Please bare in mind i am using a legacy db > > Model > #-------- > db.define_table('tblmake', > Field('MakeID','id'), > Field('Make','string'), > format="%(Make)s", > migrate=False) > > > #-------- > db.define_table('tblmodels', > Field('Model','string'), > Field('ModelID','id'), > Field('MakeID','reference tblmake'), > format="%(Model)s", > migrate=False) > > > #-------- > db.define_table('tblvehicles', > Field('VehicleID','id'), > Field('Registration','string'), > Field('Driver','string'), > Field('Model','reference tblmodels'), > migrate=False) > > Controller > > vehiclefields = [db.tblvehicles.Registration, db.tblvehicles.Driver, > db.tblvehicles.Model] > > vehiclelinks = [lambda row: A('View > Post',_href=URL("search","test",args=[row.VehicleID]))] > vehicles = SQLFORM.smartgrid(db.tblvehicles, orderby="VehicleID Desc", > fields=vehiclefields, formname="vehiclegrid", > details=False, editable=False, > deletable=False,links=vehiclelinks, linked_tables=False) > > I would like to display the db.tblmake.Make field > > How can I do this? > Can I do this? > > I have tried adding various combinations but with no luck > > 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/groups/opt_out.