mirror of
https://github.com/netbox-community/netbox.git
synced 2026-04-28 03:37:34 +02:00
Add a GenericRelation to BaseInterface allowing MACAddress objects to be queried via "interface" reverse relation in permissions
This commit is contained in:
@@ -618,6 +618,12 @@ class BaseInterface(models.Model):
|
|||||||
null=True,
|
null=True,
|
||||||
verbose_name=_('primary MAC address')
|
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:
|
class Meta:
|
||||||
abstract = True
|
abstract = True
|
||||||
|
|||||||
Reference in New Issue
Block a user