Nevermind. Just read about the represent functionality for fields and that 
addressed this issue.

For anyone else searching for this problem, this is what I ended up doing:
    
Field('jack_id_string',db.jack_listings,requires=[IS_NOT_IN_DB(db,'t_port_to_jack.jack_id_string')],
        represent= lambda jack,row: db(db.jack_listings.id == 
row.jack_id_string).select()[0].jack_and_bldg),

(db.jack_listings is another table and 'jack_and_bldg' was the field I 
wanted to show up in the grid tables instead of the id #)

--Mike


On Tuesday, May 22, 2012 2:35:01 PM UTC-4, Mike wrote:
>
> Hello,
>
> I am running into a representation issue whenever I try to put a validator 
> on a reference field. For example, I have the following table:
> db.define_table('t_port_to_jack',
>     Field('switch', db.switches),
>     Field('switch_port_string', type='integer', notnull=True,required= 
> True,label=T('The port of the switch the jack connects to')),
>     
> Field('jack_id_string',db.jack_listings,requires=IS_NOT_IN_DB(db,'t_port_to_jack.jack_id_string')))
>
> So the problem I am having is with jack_id_string, I need it to be unique 
> in this table but the issue is that as soon as I add this 'requires' 
> statement at the end, in all of the CRUD table views, it no longer shows 
> the field represented string and instead shows the id #. After I remove the 
> requires statement it reverts to the desired behavior where users see the 
> db.jack_listings format string instead of the id#.
>
> My question is, how can I keep this requires functionality but still have 
> the field display as the correct representation in tables?
>
> Thanks for your help in advance!
> Mike
>
>

Reply via email to