Is it possible to show the referenced name field, instead of the id
when showing a grid of a many2many table?


my model:

tsmadm.define_table('report_contact',
    Field ('report_id',         db.reports,
requires=IS_IN_DB(db, db.reports.id,'%(name)s')   ),
    Field ('contact_id',       db.contacts,
requires=IS_IN_DB(db, db.contacts.id,'%(name)s')  ),
    )


my controller:

def reportcontact():
    gridquery=(rc.report_id==int(request.vars.rid))
    grid = SQLFORM.grid(gridquery,)
    return dict(grid=grid)

result looks like

id    report_id   contact_id
1     1              2                        view edit delete
3     1              1                        view edit delete


As you can see the numbers don't give me any information, i would like
to see

In other forms, taken from the model, i get drop downs based on the
name.

I would expect the default view of this grid would also show the
names, instead of the id's   -  taken from the model (requires
IS_IN_DB).


Jean-Paul

Reply via email to