linked_tables in smartgrid can be a dict()
This commit is contained in:
1 parent
68f63dc89b
commit
2e0e559c59
2 files changed
+6
-2
No files matched your search
@@ -1 +1 @@
|
|||||||
Version 2.0.9 (2012-09-23 14:37:46) stable
|
Version 2.0.9 (2012-09-23 16:30:25) stable
|
||||||
+5
-1
@@ -2249,7 +2249,9 @@ class SQLFORM(FORM):
|
|||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
if nargs>len(args)+1:
|
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:
|
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]))
|
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):
|
except (KeyError,ValueError,TypeError):
|
||||||
@@ -2274,6 +2276,8 @@ class SQLFORM(FORM):
|
|||||||
if rfield.readable:
|
if rfield.readable:
|
||||||
check[rfield.tablename] = \
|
check[rfield.tablename] = \
|
||||||
check.get(rfield.tablename,[])+[rfield.name]
|
check.get(rfield.tablename,[])+[rfield.name]
|
||||||
|
if isinstance(linked_tables,dict):
|
||||||
|
linked_tables = linked_tables[tablename]
|
||||||
for tablename in sorted(check):
|
for tablename in sorted(check):
|
||||||
linked_fieldnames = check[tablename]
|
linked_fieldnames = check[tablename]
|
||||||
tb = db[tablename]
|
tb = db[tablename]
|
||||||
|
|||||||
Reference in new issue
Block a user