mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-26 09:16:10 -06:00
Begin logic
This commit is contained in:
parent
c65b2a080f
commit
4ea3fad27c
@ -351,6 +351,13 @@ class IPAddressForm(TenancyForm, NetBoxModelForm):
|
|||||||
'primary_for_parent', "Only IP addresses assigned to an interface can be designated as primary IPs."
|
'primary_for_parent', "Only IP addresses assigned to an interface can be designated as primary IPs."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Do not allow assigning a network ID or broadcast address to an interface
|
||||||
|
if interface:
|
||||||
|
if self.instance.ip == self.instance.network:
|
||||||
|
self.add_error('interface', "This address is a network ID, which may not be assigned to an interface.")
|
||||||
|
if self.instance.ip == self.instance.broadcast:
|
||||||
|
self.add_error('interface', "This address is a broadcast address, which may not be assigned to an interface.")
|
||||||
|
|
||||||
def save(self, *args, **kwargs):
|
def save(self, *args, **kwargs):
|
||||||
ipaddress = super().save(*args, **kwargs)
|
ipaddress = super().save(*args, **kwargs)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user