Merge pull request #18491 from antoinekh/17542-Contact_Assignment_to_vpn_tunnels

#17542 contact assignment to vpn tunnels
This commit is contained in:
bctiemann 2025-02-25 09:23:14 -05:00 committed by GitHub
commit a8b4024016
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 3 deletions

View File

@ -6,7 +6,7 @@ from django.urls import reverse
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from netbox.models import ChangeLoggedModel, OrganizationalModel, PrimaryModel from netbox.models import ChangeLoggedModel, OrganizationalModel, PrimaryModel
from netbox.models.features import CustomFieldsMixin, CustomLinksMixin, TagsMixin from netbox.models.features import ContactsMixin, CustomFieldsMixin, CustomLinksMixin, TagsMixin
from vpn.choices import * from vpn.choices import *
__all__ = ( __all__ = (
@ -16,7 +16,7 @@ __all__ = (
) )
class TunnelGroup(OrganizationalModel): class TunnelGroup(ContactsMixin, OrganizationalModel):
""" """
An administrative grouping of Tunnels. This can be used to correlate peer-to-peer tunnels which form a mesh, An administrative grouping of Tunnels. This can be used to correlate peer-to-peer tunnels which form a mesh,
for example. for example.
@ -27,7 +27,7 @@ class TunnelGroup(OrganizationalModel):
verbose_name_plural = _('tunnel groups') verbose_name_plural = _('tunnel groups')
class Tunnel(PrimaryModel): class Tunnel(ContactsMixin, PrimaryModel):
name = models.CharField( name = models.CharField(
verbose_name=_('name'), verbose_name=_('name'),
max_length=100, max_length=100,

View File

@ -68,6 +68,11 @@ class TunnelGroupBulkDeleteView(generic.BulkDeleteView):
table = tables.TunnelGroupTable table = tables.TunnelGroupTable
@register_model_view(TunnelGroup, 'contacts')
class TunnelGroupContactsView(ObjectContactsView):
queryset = TunnelGroup.objects.all()
# #
# Tunnels # Tunnels
# #
@ -132,6 +137,11 @@ class TunnelBulkDeleteView(generic.BulkDeleteView):
table = tables.TunnelTable table = tables.TunnelTable
@register_model_view(Tunnel, 'contacts')
class TunnelContactsView(ObjectContactsView):
queryset = Tunnel.objects.all()
# #
# Tunnel terminations # Tunnel terminations
# #