我使用以下内容突出显示日期大于当前日期的日期字段。
db.stock_task.ESI_withhold_until_date.represent=lambda v,
row:SPAN(datetime.date(v),_class='withhold' if v and v>
datetime.date.today()else None)
db.stock_task.withhold_until_date.represent = lambda v, row:
SPAN(prettydate(v),_class='withhold' if v and v>datetime.date.today()
else None)
错误日志:
Traceback (most recent call last):
File "/home/tony/web2py/gluon/restricted.py", line 227, in restricted
exec ccode in environment
File "/home/tony/web2py/applications/cps5c/controllers/default.py",
line 562, in <module>
File "applications/cps5c/modules/plugin_sqleditable/editable.py",
line 415, in extract
r=func()
File "/home/tony/web2py/gluon/tools.py", line 3774, in f
return action(*a, **b)
File "/home/tony/web2py/applications/cps5c/controllers/default.py", l
ine 268, in stock_tasks
db.stock_task.created_by,
File "/home/tony/web2py/gluon/sqlhtml.py", line 2717, in grid
nvalue = field.represent(value, row)
File "/home/tony/web2py/applications/cps5c/models/db1.py",
line 144, in <lambda>
db.stock_task.ESI_withhold_until_date.represent = lambda v,
row: SPAN(datetime.date (v),_class='withhold' if v >
datetime.date.today()else None)
TypeError: an integer is required
如果我使用以下内容它可以正常工作。
db.stock_task.withhold_until_date.represent = lambda v, row:
SPAN(prettydate(v),_class='withhold' if v and v>datetime.date.today()
else None)
任何帮助表示赞赏
欢呼声
答案 0 :(得分:0)
db.stock_task.ESI_withhold_until_date.represent = lambda v, row: SPAN(v,_class='withhold' if v > datetime.date.today()else None)