0

I am using the follow to highlight a date field where the date is greater then the current date.

    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)

Error log:

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 

if I use the following it works fine.

    db.stock_task.withhold_until_date.represent = lambda v, row:
    SPAN(prettydate(v),_class='withhold' if v and v>datetime.date.today()
    else None)

any help appreciated

cheers

sadaf2605
  • 7,332
  • 8
  • 60
  • 103

1 Answers1

0
db.stock_task.ESI_withhold_until_date.represent = lambda v, row: SPAN(v,_class='withhold' if v > datetime.date.today()else None)
Celeo
  • 5,583
  • 8
  • 39
  • 41