Ok, I don't understand... Can you go back one step and explain what kind of
information you want to manage and why you think you have to update the IP
address... Is there multiple records with the same server name if so why...
It seems to me that you want to manage kind of history of IP attached to a
given device... If so, you DB schema is not sufficient, you will need an
archive table which will contains the old state of your server record... In
your server table there will be only a single record for each of your
server and in the history table when you update this single record the old
state of the record will be copied there, so you can track all the IP a
given server had in the past... An history table is easy achieve in web2py
with record versioning...

Richard

On Thu, May 7, 2015 at 6:52 AM, <kecajkecaj...@gmail.com> wrote:

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

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