mydict = dict(1=T(''), 2=T('')) db.define_table('mytable', Field('myfield', represent=lambda v, r: mydict[v]))
Anthony On Wednesday, June 11, 2014 10:50:06 AM UTC-4, Stefan van den Eertwegh wrote: > > Hi Anthony, > > Me and my colleges tried it with represent but we cant figure it out. > Can you give an example how this should work? > The table and column is templates.type (key: value) > > Regards, > Stefan van den Eertwegh > > Op woensdag 11 juni 2014 16:37:13 UTC+2 schreef Anthony: >> >> The IS_IN_SET validator affects form widgets but not other displays of >> the values in the field. If you want to change the way a value is displayed >> in a grid (or SQLTABLE), you must use the "represent" attribute of the >> field. >> >> Anthony >> >> On Wednesday, June 11, 2014 8:58:54 AM UTC-4, Stefan van den Eertwegh >> wrote: >>> >>> Hi all, >>> >>> I have a model where a Field has IS_IN_SET({'1':T(''),2:T('')}). >>> >>> When you have a grid in web2py; When you edit the record you see the >>> value (the translatable string). >>> But when you view the record you see the key of the IS_IN_SET. >>> >>> IS is possible to have the grid showing the value from the IS_IN_SET in >>> the view? >>> >>> Thank you! >>> >> -- 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.