[web2py] Re: multiple conditionals possible in grid formatting statements?

2015-12-04 Thread Anthony
Python ternary expressions are just expressions, so one element of a ternary can itself be another ternary (i.e., you can nest them). So, you can do: 1 if condition1 else 2 if condition2 else 3 which for clarity you could write as: 1 if condition1 else (2 if condition 2 else 3) As an aside, l

[web2py] Re: multiple conditionals possible in grid formatting statements?

2015-12-04 Thread Alex Glaros
sorry, I over simplified. I'd like to handle more than two conditionals. For example, based on another field's value, I would like a different message to appear. So with two conditionals, syntax does work. Seel yellow connection_canceling_links = [dict(header='Cancel connection', body=lamb

[web2py] Re: multiple conditionals possible in grid formatting statements?

2015-12-04 Thread 黄祥
pardon, i'm a little bit confuse with your code, i think you can create the links in grid with the a href, and then put the represent for coloring it's font via dal represent e.g. not tested table_status = {True, False} db.table.is_active.represent = lambda is_active, field: SPAN(table_status[i