From 45c646dcecdf8eedd9aec08b7fc9df1c694c8d7c Mon Sep 17 00:00:00 2001 From: Daniel Sheppard Date: Thu, 28 Dec 2023 12:28:05 -0600 Subject: [PATCH] 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 --- netbox/ipam/models/ip.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/netbox/ipam/models/ip.py b/netbox/ipam/models/ip.py index d176d3bff..5d3fe4a3a 100644 --- a/netbox/ipam/models/ip.py +++ b/netbox/ipam/models/ip.py @@ -864,11 +864,9 @@ class IPAddress(PrimaryModel): is_primary = True if is_primary and (parent != original_parent): - raise ValidationError({ - 'assigned_object': _( - "Cannot reassign IP address while it is designated as the primary IP for the parent object" - ) - }) + raise ValidationError( + _("Cannot reassign IP address while it is designated as the primary IP for the parent object") + ) # Validate IP status selection if self.status == IPAddressStatusChoices.STATUS_SLAAC and self.family != 6: