Hi, What's the difference between what i wrote and what You wrote? And i believe You didn't get my point. Checking if IP is Free works correctly. Point is that i want do update the one row in Server table and change i.e. server name. I click on update button provided by grid, and i can change the name of the server (withouth changing its IP), but i need to chose an IP as well. Problem is that on the IP list, IP i used for that server before is marked as Used, so i won't see it on the list and i can't chose it again. How to make it available for selection while i'm updating the row.
Thanks On Wednesday, 6 May 2015 16:52:05 UTC+2, Richard wrote: > > 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, <kecajk...@gmail.com <javascript:>> 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 web2py+un...@googlegroups.com <javascript:>. >> 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.