I am not sure I fully understand but I think you want this:
def artist():
rows = db().select(db.media.artist,db.media.id, groupby =
db.media.artist)
links = map(lambda row:A(row.artist,
callback=URL('album',vars=dict(id=row.id)), target='album'), rows)
return dict(links=DIV(*links))
On Saturday, 21 March 2015 13:19:02 UTC-5, Garry Smith wrote:
>
> Hi
> I'm trying to return the some links to a div. I have made links with some
> information from the database and using the A htlm helper.
> The problem I am having is getting the data back correctly, I am getting
> the links back correctly, but I am being sent a full web page with the
> links, which is then put in the div.
>
> *VIEW*
> this is link which is sent to the artist page, which gets all the distinct
> artist.
>
> {{=A('click' , callback=URL('artist'), target="artist")}}
>
> *CONTROLLER*
>
> This is the controller that makes the links and returns to the div as
> specified in above link.
>
> def artist():
> rows = db().select(db.media.artist,db.media.id, groupby =
> db.media.artist)
>
> links = []
>
> for row in rows:
> a = str(row.id)
> b = 'album?id='
> c = b+a
> l = row.artist
> f = A(l , callback=URL(c), target="album")
> links.append(f)
>
> return dict(links=links)
>
> I have tried diffrent ways to solve this, but to no avail, all I want is
> to return the links to div.
>
> What i am trying to do is rewrite a media player, which I wrote in php a
> few years ago, but I am having few issues writing a returning links on the
> sly.
>
> Thanks in advance for any help.
>
>
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.