Skip to content

Commit

Permalink
Fixes: #18433 - Fix missing is_primary property on MACAddress model
Browse files Browse the repository at this point in the history
  • Loading branch information
DanSheps committed Jan 21, 2025
1 parent d11deb6 commit 51a7950
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions netbox/dcim/models/devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -1522,3 +1522,10 @@ class Meta:

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

0 comments on commit 51a7950

Please sign in to comment.