Add a GenericRelation to BaseInterface allowing MACAddress objects to be queried via "interface" reverse relation in permissions

This commit is contained in:
Brian Tiemann 2025-10-02 22:03:11 -04:00
parent 5f77d684e1
commit 15f695b35a

View File

@ -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',
)
class Meta:
abstract = True