mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-26 01:06:11 -06:00
requested changes
This commit is contained in:
parent
5cbe3324a2
commit
d008b5ca11
@ -362,13 +362,12 @@ class IPAddressForm(TenancyForm, NetBoxModelForm):
|
|||||||
|
|
||||||
# Do not allow assigning a network ID or broadcast address to an interface.
|
# Do not allow assigning a network ID or broadcast address to an interface.
|
||||||
if interface and (address := self.cleaned_data.get('address')):
|
if interface and (address := self.cleaned_data.get('address')):
|
||||||
prefix_str = f"{address.network}/{address.prefixlen}"
|
|
||||||
allow_assignment_error = True
|
allow_assignment_error = True
|
||||||
if self.instance.vrf is None:
|
if self.instance.vrf is None:
|
||||||
prefix_obj = Prefix.objects.filter(prefix=prefix_str)
|
prefix_obj = Prefix.objects.filter(prefix=address.cidr)
|
||||||
else:
|
else:
|
||||||
prefix_obj = Prefix.objects.filter(prefix=prefix_str, vrf=self.vrf)
|
prefix_obj = Prefix.objects.filter(prefix=address.cidr, vrf=self.vrf)
|
||||||
if prefix_obj.exists() and prefix_obj[0].is_pool:
|
if prefix_obj.exists() and prefix_obj.first().is_pool:
|
||||||
allow_assignment_error = False
|
allow_assignment_error = False
|
||||||
|
|
||||||
if allow_assignment_error:
|
if allow_assignment_error:
|
||||||
|
Loading…
Reference in New Issue
Block a user