For now I've hacked sqlhtml.py with the following to achieve this:
in "smartgrid" def after the first try block (i.e. following line 1938
(v1.99.4): "redirect(URL(args=table._tablename))")
# RM: mod to create links in reference fields
if linked_tables:
for field in table:
referee_t = field.type[10:]
if referee_t and referee_t != table and referee_t in
linked_tables:
field.represent = lambda
id,r=None,referee_t=referee_t,rep=field.represent: A(callable(rep) and
rep(id) or
id,_class=trap_class(),_href=URL(args=request.args[:nargs]+['view',referee_t,id],
user_signature=user_signature))
# RM: end mod
To use it, list the tables you want to use the links with in the
"linked_tables" parameter to the smartgrid.
The breadcrumbs aren't perfect but match the standard behaviour when
clicking on referenced fields anyway. Also there's a "http 400: not found"
when clicking a button in the new view referencing another table - not
introduced by this mod though so that's one for a ticket...
Trying to use "represent" on the table fields themselves became too
complex. I haven't tried "links" yet as I prefer the click on field
approach as opposed to adding buttons...
Open to suggestions / improvements though,
Thanks!