Actually, if I look at the View, Edit and Delete buttons generated by the grid, it seems that in the case of a simple query the grid knows which table to use, but in the case of an inner join it arbitrarily selects the first table as the "main table" and generates links and buttons accordingly.
On Thursday, August 28, 2014 5:04:36 PM UTC+2, Louis Amon wrote: > > > I have a simple one-to-many relation like so: > > db.define_table('person', Field('job')) > db.define_table('thing', Field('owner_id', 'reference person')) > > And I built a grid using SQLFORM.grid like so: > grid = SQLFORM.grid((db.person.id == db.thing.owner_id), > fields=[db.thing.owner_id, db.person.job], > links=[dict(header='Details for thing', > body=thing_link) > ], > ) > > With the function thing_link defined like this: > def thing_link(row): > print row > return A('controller', 'function', args=[row.thing.uuid]) > > > I get a ticket when loading the grid, and as far as I can tell looking at > the print in thing_link, the row passed in the body of the link does not > contain both tables of the inner join : it only contains whichever comes > first (so row.person in this case, in terms or alphabetical order). > > Is there a way around this ? > -- 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.