fixed bug in sqlform.grid

This commit is contained in:
mdipierro committed 2013-07-26 03:03:49 -05:00
1 parent b63e8994e4
commit 6aa0ff50b2
2 files changed
+5 -6

No files matched your search

+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
+4 -5
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:
t = T('%s(%s)' %(tbl, fld))
else:
t = T(tb._plural)
for fld in linked_tables[tbl]: for fld in 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('%s(%s)' %(tbl, fld))
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(
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(