>
> 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).


The IS_IN_DB validator will result in the "name" field being showing in 
select widgets, but it won't affect the field representation in 
tables/grids. For that, you have to specify the "represent" attribute of 
the field. Note, if the referenced table includes a "_format" attribute 
(set via the "format" argument to define_table), then the "represent" 
attribute of the reference field will be set automatically (in that case, 
the IS_IN_DB validator will also be set automatically). So, just do the 
following:

tsmadm.define_table('reports', ..., format='%(name)s')
tsmadm.define_table('contacts', ..., format='%(name)s')
tsmadm.define_table('report_​contact', 
    Field('report_id', db.reports), 
    Field('contact_id', db.contacts))

That will automatically add the IS_IN_DB validator to the two reference 
fields as well as set their "represent" attribute to display the "name" 
field of the referenced record.

I also recommend having a look at http://www.python.org/dev/peps/pep-0008/ 
regarding Python code formatting.

Anthony

Reply via email to