A set which you have, but your validator has wrong syntax : IS_IN_DB(db(db.ipaddress.status=='Free'),db.ipaddress.ip, '%(ip)s')
free_ip_set = db(db.ipaddress.status=='Free') IS_IN_DB(free_ip_set, 'ipaddress.ip', '%(ip)s') Try this... You define the set before you server table and after the ipaddress table.. Richard On Tue, May 5, 2015 at 9:46 AM, <[email protected]> wrote: > Hi All, > > I have very basic dtabasae where in one table i have IPs which are used in > second table: > > db.define_table('ipaddress', > Field('ip', unique=True, length=200,requires=IS_NOT_EMPTY()), > Field('subnet', length=200, requires=IS_NOT_EMPTY() ), > Field('status', length=200, default="Free", > requires=IS_IN_SET(['Free','Used'])), > format = '%(ip)s') > > db.define_table('server', > Field('servername', length=200), > Field('port', length=200, requires=IS_NOT_EMPTY()), > Field('ipaddress', unique=True, length=200, > requires=IS_IN_DB(db(db.ipaddress.status=='Free'),db.ipaddress.ip, > '%(ip)s')), > > > The problem i'm having is that with grid i can delete and add new values > to "server" table and i added function which update status of IP for USED > or FREE after insert/delete. > Problem is with Update function as when i try to update server name i need > to chose IP again and i can't chose same IP as it is marked in ipaddress > table as USED hence it's not displayed in dropdown menu. > How can i display all IPs that are marked as FREE in ipaddress table AND > IPs that where currently assign to the record i'm updateing in table > server? > > Regards. > > -- > 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 [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.

