From 9fb94008eab508ccb23827974493960c07c10570 Mon Sep 17 00:00:00 2001 From: mdipierro Date: Sun, 23 Sep 2012 16:30:31 -0500 Subject: [PATCH] linked_tables in smartgrid can be a dict() --- VERSION | 2 +- gluon/sqlhtml.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 0b83584a..8cc470a8 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.0.9 (2012-09-23 14:37:46) stable +Version 2.0.9 (2012-09-23 16:30:25) stable diff --git a/gluon/sqlhtml.py b/gluon/sqlhtml.py index 2fbf3c14..250ab6f0 100644 --- a/gluon/sqlhtml.py +++ b/gluon/sqlhtml.py @@ -2249,7 +2249,9 @@ class SQLFORM(FORM): else: break if nargs>len(args)+1: - query = (field == id) + query = (field == id) + if isinstance(linked_tables,dict): + linked_tables = linked_tables[table._tablename] if linked_tables is None or referee in linked_tables: field.represent = lambda id,r=None,referee=referee,rep=field.represent: A(callable(rep) and rep(id) or id,_class=trap_class(),_href=url(args=['view',referee,id])) except (KeyError,ValueError,TypeError): @@ -2274,6 +2276,8 @@ class SQLFORM(FORM): if rfield.readable: check[rfield.tablename] = \ check.get(rfield.tablename,[])+[rfield.name] + if isinstance(linked_tables,dict): + linked_tables = linked_tables[tablename] for tablename in sorted(check): linked_fieldnames = check[tablename] tb = db[tablename]