mirror of
https://github.com/netbox-community/netbox.git
synced 2025-12-20 04:12:25 -06:00
Fixes #20876: Allow editing IPAddress in IPRange marked populated
This commit is contained in:
committed by
Jeremy Stretch
parent
2699149016
commit
265f375595
@@ -910,13 +910,13 @@ class IPAddress(ContactsMixin, PrimaryModel):
|
|||||||
})
|
})
|
||||||
|
|
||||||
# Disallow the creation of IPAddresses within an IPRange with mark_populated=True
|
# Disallow the creation of IPAddresses within an IPRange with mark_populated=True
|
||||||
parent_range = IPRange.objects.filter(
|
parent_range_qs = IPRange.objects.filter(
|
||||||
start_address__lte=self.address,
|
start_address__lte=self.address,
|
||||||
end_address__gte=self.address,
|
end_address__gte=self.address,
|
||||||
vrf=self.vrf,
|
vrf=self.vrf,
|
||||||
mark_populated=True
|
mark_populated=True
|
||||||
).first()
|
)
|
||||||
if parent_range:
|
if not self.pk and (parent_range := parent_range_qs.first()):
|
||||||
raise ValidationError({
|
raise ValidationError({
|
||||||
'address': _(
|
'address': _(
|
||||||
"Cannot create IP address {ip} inside range {range}."
|
"Cannot create IP address {ip} inside range {range}."
|
||||||
|
|||||||
Reference in New Issue
Block a user