[web2py] Re: Customize SQLFORM.grid fields

2013-06-10 Thread Niphlod
there are multiple errors (and lots of unnecessary parenthesis). first of all, define a single function to represent your value def represent_colored(value): if value == 1: return .. <--green elif value == 2: yellow elif value == 3:

[web2py] Re: Customize SQLFORM.grid fields

2013-06-10 Thread keeperdss
Thanks for the reply, Niphlod. Now there was the following question: I add the following lines to the controller before the grid = SQLFORM.grid ... warn = db.executesql ('SELECT t.level_warn FROM TEMPER_RC t;') for val in warn: if (val == (1)): db.TEMPER_RC.level_warn.represent

[web2py] Re: Customize SQLFORM.grid fields

2013-06-06 Thread Niphlod
grid uses represent if available. http://web2py.com/books/default/chapter/29/06?search=represent#Record-representation On Thursday, June 6, 2013 2:46:47 PM UTC+2, keep...@gmail.com wrote: > > Hello everyone. > > I'm new to web2py and I have a question about customizing fields in > SQLform.grid.