fixed bug in sqlform.grid

This commit is contained in:
mdipierro
2013-07-26 03:03:49 -05:00
parent b63e8994e4
commit 6aa0ff50b2
2 changed files with 12 additions and 13 deletions
+1 -1
View File
@@ -1 +1 @@
Version 2.6.0-development+timestamp.2013.07.25.08.13.15 Version 2.6.0-development+timestamp.2013.07.26.03.03.00
+11 -12
View File
@@ -2621,25 +2621,24 @@ class SQLFORM(FORM):
if isinstance(linked_tables, dict): if isinstance(linked_tables, dict):
for tbl in linked_tables.keys(): for tbl in linked_tables.keys():
tb = db[tbl] tb = db[tbl]
if isinstance(linked_tables[tbl], list) and len(linked_tables[tbl])==1:
linked_tables[tbl] = linked_tables[tbl][0]
if isinstance(linked_tables[tbl], list): if isinstance(linked_tables[tbl], list):
if len(linked_tables[tbl]) > 1: for fld in linked_tables[tbl]:
t = T('%s(%s)' %(tbl, fld)) if fld not in db[tbl].fields:
else: raise ValueError('Field %s not in table' %fld)
t = T(tb._plural) args0 = tbl + '.' + fld
for fld in linked_tables[tbl]: t = T('%s(%s)' %(tbl, fld))
if fld not in db[tbl].fields: links.append(
raise ValueError('Field %s not in table' %fld) lambda row, t=t, nargs=nargs, args0=args0:
args0 = tbl + '.' + fld
links.append(
lambda row, t=t, nargs=nargs, args0=args0:
A(SPAN(t), _class=trap_class(), _href=url( A(SPAN(t), _class=trap_class(), _href=url(
args=[args0, row[id_field_name]]))) args=[args0, row[id_field_name]])))
else: else:
t = T(tb._plural)
fld = linked_tables[tbl] fld = linked_tables[tbl]
if fld not in db[tbl].fields: if fld not in db[tbl].fields:
raise ValueError('Field %s not in table' %fld) raise ValueError('Field %s not in table' %fld)
args0 = tbl + '.' + fld args0 = tbl + '.' + fld
t = T(tb._plural)
links.append( links.append(
lambda row, t=t, nargs=nargs, args0=args0: lambda row, t=t, nargs=nargs, args0=args0:
A(SPAN(t), _class=trap_class(), _href=url( A(SPAN(t), _class=trap_class(), _href=url(