[web2py] Re: SQLFORM.grid: represent a field with IS_IN_SET validator by its label instead of its value

2018-04-21 Thread xelomac
I've found a solution: rows = db(db[table].id == id).select() rendered_row = rows.render(0, fields=[db[table][column]]) value = rendered_row[column] On Saturday, April 21, 2018 at 12:31:49 PM UTC+2, xelomac wrote: > > Thank you Anthony. Works perfectly in a SQLFORM.grid. The values get > display

[web2py] Re: SQLFORM.grid: represent a field with IS_IN_SET validator by its label instead of its value

2018-04-21 Thread xelomac
Thank you Anthony. Works perfectly in a SQLFORM.grid. The values get displayed as expected. But outside of the grid for something like this persons = db(db[table].id == 1).select() person=persons[0][column] the stored values get displayed not its representation. How can I get the representati

[web2py] Re: SQLFORM.grid: represent a field with IS_IN_SET validator by its label instead of its value

2018-04-15 Thread Anthony
The validator controls the widget used in forms but no the format in the grid -- for the latter, use the "represent" attribute: represent=lambda v, r: GENDER[v] Anthony On Sunday, April 15, 2018 at 4:47:27 AM UTC-4, xelomac wrote: > > Consider the following example. > > Model: > > GENDER = {"ma