I was learning the correct method to get the rows of a tables where I get the values of referenced fields, not the id. I found the render() method might be what I need.
However, when I try it I get a 'Rows.render() needs a `rows_render`' error when I call render() on selected rows.
Ultimately I want to return rows that include all the values of any referenced tables, but I cant get this to work even on the simplest example like below. I wonder if I am not understanding the concepts.
In a model, I have:
db.define_table('person', Field('name'), format='%(name)s,)
db.person.name.represent = lambda name, row: name.capitalize()
in the controller I have:
@action(
'index')
@action.uses(db, auth,
'index.html')
def index(path=
None):
myquery =
db.person.id !=
None
rows = db(myquery).select()
repr_row = rows.render(0)
return dict(rows=repr_row)
If anyone has an example of how to retrieve the values of a table where all referenced field values are included in each row that I could study, maybe that would help me understand the steps.
Thanks for any advice