perhaps you can use unique=True on your table 'server'
e.g. 1
db.define_table('server',
   Field('servername', length=200),
   Field('port', length=200),
   Field('ipaddress_id', unique=True, 'reference ipaddress'))
   
db.server.ipaddress_id.requires = IS_IN_DB(db,db.ipaddress.id, '%(ip)s')

another thing, is you can use query for that.
e.g.2
db.define_table('ipaddress',
   Field('ip', unique=True, length=200),
   Field('subnet', length=200),
   Field('status', length=200),   
   format = '%(ip)s')

def __after_insert_server(f, id):
db(db.ipaddress.id == f.ipaddress_id).update(status = T('Recorded') )
db.ipaddress.status.default = T('Unrecorded')
db.server._after_insert.append(__after_insert_server)
db.server.ipaddress_id.requires = IS_IN_DB(db(db.ipaddress.status == 
T('Unrecorded') ), db.ipaddress.id, '%(ip)s')

best regards,
stifan

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