You can try this way db.articles.conteneur.represent = lambda cntnumok, row: SPAN*(*row[ 'conteneur'], _class='cnt-false'*)* if cntnumok==False and cntnumok else None
Check parenthesis El mié., 21 de nov. de 2018 a la(s) 07:42, Yann Dulondel ( yann.dulon...@gmail.com) escribió: > > > Le mercredi 21 novembre 2018 10:51:16 UTC+1, Yann Dulondel a écrit : >> >> Hi all, >> I have a container number and a function that check the number is valid. >> The result of the function is store in field cntnumok (boolean). >> I found that we can change the color with "represent" and found an >> example in webgroup. >> >> db.articles.conteneur.represent = lambda v, row: SPAN(v, _class= >> 'cnt-false' if db.articles.cntnumok==False else None) >> I understand lambda is an inline function, i want that the if test the >> value of "cntnumok" for the row >> How can i have the value of "cntnumok" for the row? >> I tried this also >> db.articles.conteneur.represent = lambda v, row: >> SPAN(v,_class='cnt-false' if row.cntnumok==False else None) >> >> Try this > db.articles.conteneur.represent = lambda cntnumok, row:SPAN(row[ > 'conteneur'], _class='cnt-false' if cntnumok==False and cntnumok else None > ) > > No error message but the color doesn't change > >> Yann >> > -- > Resources: > - http://web2py.com > - http://web2py.com/book (Documentation) > - http://github.com/web2py/web2py (Source code) > - https://code.google.com/p/web2py/issues/list (Report Issues) > --- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.