فهرست منبع

fix ip address assignment #12953

Abhimanyu Saharan 2 سال پیش
والد
کامیت
27e850a68d
1فایلهای تغییر یافته به همراه1 افزوده شده و 1 حذف شده
  1. 1 1
      netbox/ipam/forms/model_forms.py

+ 1 - 1
netbox/ipam/forms/model_forms.py

@@ -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"
                 )
                 )