I belive that format is intended for string output:

"... defines a format string for the table. It determines how a record
should be represented as a string. ..."

For presenting other objects you could use the Field attribute
represent

"... table.id.represent = lambda id, row: \
A('edit:',id,_href=URL(args=(request.args(0),id)))
(...)
represent=... that tells web2py to change the
representation of the id field and display a link instead to the page
itself
..."

Extracted from the web2py book, 4th edition, section 7.4.3


On Feb 12, 2:43 pm, Keith Edmunds <[email protected]> wrote:
> I have a form based on a table which includes foreign fields. By default,
> the foreign fields are displayed as the name from the foreign table
> as expected.
>
> I want to have an image displayed rather than the name from the foreign
> table.
>
> Not having used 'format' before, I changed the format of the foreign table
> to:
>
>         format="xyz"
>
> As expected, every row now displayed "xyz". I then changed to:
>
>         format=URL('static','images/red.jpg')
>
> and again, as expected, the URL string appears in every row. Then I did:
>
>         format=IMG(_src=URL('static','images/red.jpg'))
>
> and now no foreign key lookup seems to occur at all: I just get the id
> value showing in the table.
>
> I have two questions:
>
> Why does that happen and
> How can I display an image for a foreign key value?
>
> Thanks for pointers or help!
> --
> "You can have everything in life you want if you help enough other people
> get what they want" - Zig Ziglar.
>
> Who did you help today?

Reply via email to