Skip to content

Commit 45c646d

Browse files
authored
Fixes #14482 - Fix validation error when primary IP is moved (#14514)
* Fix validation when primary IP is moved. * Fix views test * Work on excluding assigned_objects * Modify clean() on model and form to properly catch error * Fix test failure * Fix test to check for PK * Remove model_form check
1 parent fedcbaf commit 45c646d

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

netbox/ipam/models/ip.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -864,11 +864,9 @@ def clean(self):
864864
is_primary = True
865865

866866
if is_primary and (parent != original_parent):
867-
raise ValidationError({
868-
'assigned_object': _(
869-
"Cannot reassign IP address while it is designated as the primary IP for the parent object"
870-
)
871-
})
867+
raise ValidationError(
868+
_("Cannot reassign IP address while it is designated as the primary IP for the parent object")
869+
)
872870

873871
# Validate IP status selection
874872
if self.status == IPAddressStatusChoices.STATUS_SLAAC and self.family != 6:

0 commit comments

Comments
 (0)