From 51a79505fe10b0599b47eacced2f31622dbc9606 Mon Sep 17 00:00:00 2001 From: Daniel Sheppard Date: Mon, 20 Jan 2025 22:21:36 -0600 Subject: [PATCH] Fixes: #18433 - Fix missing is_primary property on MACAddress model --- netbox/dcim/models/devices.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/netbox/dcim/models/devices.py b/netbox/dcim/models/devices.py index dbcd91ea0..49fd46d23 100644 --- a/netbox/dcim/models/devices.py +++ b/netbox/dcim/models/devices.py @@ -1522,3 +1522,10 @@ class MACAddress(PrimaryModel): def __str__(self): return str(self.mac_address) + + @property + def is_primary(self): + if self.assigned_object and hasattr(self.assigned_object, 'primary_mac_address'): + if self.assigned_object.primary_mac_address and self.assigned_object.primary_mac_address.pk == self.pk: + return True + return False