添加到SQLFORM.grid,Web2PY的链接

时间:2016-04-29 13:05:20

标签: python database web2py

def index():
gridHome = SQLFORM.grid(db.games, editable=False, create=False, csv=False, deletable=False, details=False, 
links = [lambda row: A('View Post',_href=URL("default","show",args=[row.id]))])
return locals()

我正在尝试添加另一个链接到SQL网格,就像上面的那个。我一直收到语法错误,因为我不知道如何写出来。

'Review',_href=URL("default","review",args=[row.id]

这是我要添加的链接。

1 个答案:

答案 0 :(得分:2)

在关闭链接括号

之前,您正在关闭全局数组
def index():
    gridHome = SQLFORM.grid(db.games, editable=False, create=False, csv=False, deletable=False, details=False, 
                            links = [lambda row: A('View Post',_href=URL("default","show",args=[row.id])), 
                                     lambda row: A('Review',_href=URL("default","review",args=[row.id]))])       

    return locals()