Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions netbox/dcim/models/device_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,12 @@ class BaseInterface(models.Model):
null=True,
verbose_name=_('primary MAC address')
)
mac_addresses = GenericRelation(
to='dcim.MACAddress',
content_type_field='assigned_object_type',
object_id_field='assigned_object_id',
related_query_name='interface',
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hrm, doesn't the Interface model already have a mac_addresses generic relation that will just override this?

Same thing for VMInterface. As a matter of fact, I think that overriding this will actually break the expectation that the related query name will be interface for MAC addresses pointing back at VM interfaces.


class Meta:
abstract = True
Expand Down