Add this below your album model...

db.album.artist_id.requires=IS_IN_DB(db,db.artist.id,'%(name)s')

You will have a dropbox instead of a empty field for artist_id field of
table album.

Richard

On Thu, Sep 1, 2011 at 1:19 PM, Christian <[email protected]> wrote:

> Hello everyone,
> given the case, I have these 2 tables:
>
> db.define_table('artist',
>                Field('name'))
>
> db.define_table('album',
>                Field('artist_id', db.artist),
>                Field('name'))
>
> How would I add a field in the album table, (e.g. artist_name), that
> references the corrosponding db.artist.name of the artist table. I
> would like to access the album table via the restful api and I don't
> want to make 2 calls to get the album first and then the artist name
> via artist_id.
>
> Thanks and regards,
> Christian
>

Reply via email to