Ver Fonte

Update UI to disable interface assignment when assigned as primary

Daniel Sheppard há 1 ano atrás
pai
commit
22e320084a
1 ficheiros alterados com 5 adições e 0 exclusões
  1. 5 0
      netbox/dcim/forms/model_forms.py

+ 5 - 0
netbox/dcim/forms/model_forms.py

@@ -1810,6 +1810,11 @@ class MACAddressForm(NetBoxModelForm):
 
         super().__init__(*args, **kwargs)
 
+        if instance and instance.assigned_object and instance.assigned_object.primary_mac_address:
+            if instance.assigned_object.primary_mac_address.pk == instance.pk:
+                self.fields['interface'].disabled = True
+                self.fields['vminterface'].disabled = True
+
     def clean(self):
         super().clean()