1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

fix ip address assignment #12953

This commit is contained in:
Abhimanyu Saharan
2023-06-23 18:08:20 +05:30
committed by Jeremy Stretch
parent c83b2499f0
commit 27e850a68d

View File

@ -345,7 +345,7 @@ class IPAddressForm(TenancyForm, NetBoxModelForm):
}) })
elif selected_objects: elif selected_objects:
assigned_object = self.cleaned_data[selected_objects[0]] assigned_object = self.cleaned_data[selected_objects[0]]
if self.cleaned_data['primary_for_parent'] and assigned_object != self.instance.assigned_object: if self.instance.pk and self.cleaned_data['primary_for_parent'] and assigned_object != self.instance.assigned_object:
raise ValidationError( raise ValidationError(
"Cannot reassign IP address while it is designated as the primary IP for the parent object" "Cannot reassign IP address while it is designated as the primary IP for the parent object"
) )