Reputation: 961
In controllers/default.py
def test():
return dict(test=db().select(db.tbl_profile.name))
I have {{=test}} in test.html but it returns to me:
tbl_card.name
Johnny Apples...
I just want the full complete name to be displayed in the html and not the name of the table.field or the incomplete name (cut off by ...).
Upvotes: 0
Views: 1598
Reputation: 21
You can have all the rows displayed by just db().select(db.tablename.fieldname). To handle the truncation issue, you can use SQLTABLE() and set truncate to None.
Upvotes: 1
Reputation: 25536
db().select(db.tbl_profile.name)
is a Rows
object -- even if it contains only one record. If you want to extract a single Row
object, you have to do:
db().select(db.tbl_profile.name)[0]
or
db().select(db.tbl_profile.name).first()
The latter is preferable because it will simply return None
if there are no records (whereas the first option will generate an exception in that case).
Once you have extracted the single Row
object, you then still have to select the particular field you want to display, even if that is the only field in the Row
. So, the code should be:
return dict(test=db().select(db.tbl_profile.name).first().name)
Upvotes: 1