Hi Guys, 

I have simple database:

db.define_table('ipaddress',
   Field('ip', unique=True, length=200),
   Field('subnet', length=200),
   format = '%(ip)s')

db.define_table('server',
   Field('servername', length=200),
   Field('port', length=200),
   Field('ipaddress_id', 'reference ipaddress'))

I have few records in ipaddress table and not would like to add some 
validators. 
When adding record to server table i would like to check if ipaddress_id 
exist in ipaddress table AND if it hasn't been used before in server table.
That can be done by doing:

db.server.ipaddress_id.requires = IS_IN_DB(db,db.ipaddress.id, '%(ip)s') 
,IS_NOT_IN_DB(db,db.server.ipaddress_id, '%(ip)s')]

But in that case Filed server.ipaddress_id is not a dropdown menu and it's 
not presented as %(ip)s. I would like to have dropdown to choose IP 
available in ipaddress table, but just the one which hasn't been used 
before. Any tips? 

Thanks, 

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to