documents is a list of IDs so you have to turn each one of them into a
link. You can try:

db.wbmaster.documents.represent = lambda value, row: SPAN(*[row.name]+
[A(v, _href = URL('download', args = v)) for v in value])

Hope I make sense.

On Oct 14, 3:29 am, Johann Spies <[email protected]> wrote:
> This table
>
> db.define_table("wbdocuments",
>                 Field("name", label = "Document name"),
>                 Field("file", "upload", label = "Download"),
>                 format = '%(name)s')
>
> is linked in another table:
>
> db.define_table('wbmaster',
>                            Field('documents', 'list:reference wbdocuments'))
>
> As long as I do not add a .represent to the second table's 'documents' I can
> see the names of the documents in smartgrid as a
> comma seperated list.
>
> I want those doccuments to be downloadable when clicked on.
>
> I see in the book
>
> db.mytable.some_uploadfield.represent = lambda value,row: \
>     A <http://web2py.com/book/default/docstring/A>('get it', _href=URL
> <http://web2py.com/book/default/docstring/URL>('download',
> args=value))
>
> can be used but so far I did not have any  success.
>
> As soon as I try
>
> db.wbmaster.documents.represent = lambda value, row: \
>         A('%s' % row.name, _href = URL('download', args = value))
>
> I just get a concatenation of the id's  (eg. 69) where without it I would
> see a string like: 'x.docx, y.pdf'
>
> Help would be appreciated.
>
> Regards
> Johann
> --
>  May grace and peace be yours in abundance through the full knowledge of God
> and of Jesus our Lord!  His divine power has given us everything we need for
> life and godliness through the full knowledge of the one who called us by
> his own glory and excellence.
>                                                     2 Pet. 1:2b,3a

Reply via email to