using this example in
Model:
db.define_table('person',
Field('name'),
format='%(name)s')
db.define_table('dog',
Field('name'),
Field('owner'), db.person)
Controller:
def list():
dog_list = db().select(db.dog.ALL)
return dict(dog_list=dog_list)
View:
{{for item in dog_list:}}
...
{{=item.name}} {{=item.owner}}
...
{{pass}}
Result sample:
Dogname1 1
Dogname2 2
Dogname3 1
How can I show in my view the owner’s name and not their id?
I’m need my own table and I can’t use SQLTABLE or another grid-table solution for this…
Thanks in advance.
Christian
You can do a recursive select via
{{=item.owner.name}}, but that will do a separate query for each record. For efficiency, you might instead want to do a join.