From 22e320084a9906159fdf2770a3c951cd80fc782b Mon Sep 17 00:00:00 2001 From: Daniel Sheppard Date: Mon, 20 Jan 2025 23:06:29 -0600 Subject: [PATCH] Update UI to disable interface assignment when assigned as primary --- netbox/dcim/forms/model_forms.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/netbox/dcim/forms/model_forms.py b/netbox/dcim/forms/model_forms.py index 9bc69e991..5a3a27d25 100644 --- a/netbox/dcim/forms/model_forms.py +++ b/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()