From 5b2241aaaf8f52c3ba425233e8d8cb815197fbb8 Mon Sep 17 00:00:00 2001 From: Antoine Keranflec'h Date: Thu, 10 Oct 2024 15:38:48 +0200 Subject: [PATCH] fix(17542) add contact to tunnels --- netbox/vpn/models/tunnels.py | 6 +++--- netbox/vpn/views.py | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/netbox/vpn/models/tunnels.py b/netbox/vpn/models/tunnels.py index 6f4fa4182..6224959eb 100644 --- a/netbox/vpn/models/tunnels.py +++ b/netbox/vpn/models/tunnels.py @@ -6,7 +6,7 @@ from django.urls import reverse from django.utils.translation import gettext_lazy as _ from netbox.models import ChangeLoggedModel, OrganizationalModel, PrimaryModel -from netbox.models.features import CustomFieldsMixin, CustomLinksMixin, TagsMixin +from netbox.models.features import CustomFieldsMixin, CustomLinksMixin, TagsMixin, ContactsMixin from vpn.choices import * __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, for example. @@ -30,7 +30,7 @@ class TunnelGroup(OrganizationalModel): return reverse('vpn:tunnelgroup', args=[self.pk]) -class Tunnel(PrimaryModel): +class Tunnel(ContactsMixin, PrimaryModel): name = models.CharField( verbose_name=_('name'), max_length=100, diff --git a/netbox/vpn/views.py b/netbox/vpn/views.py index ac8ce3667..73b2b04c0 100644 --- a/netbox/vpn/views.py +++ b/netbox/vpn/views.py @@ -62,6 +62,9 @@ class TunnelGroupBulkDeleteView(generic.BulkDeleteView): filterset = filtersets.TunnelGroupFilterSet table = tables.TunnelGroupTable +@register_model_view(Tunnel, 'contacts') +class TunnelGroupContactsView(ObjectContactsView): + queryset = TunnelGroup.objects.all() # # Tunnels @@ -121,6 +124,9 @@ class TunnelBulkDeleteView(generic.BulkDeleteView): filterset = filtersets.TunnelFilterSet table = tables.TunnelTable +@register_model_view(Tunnel, 'contacts') +class TunnelContactsView(ObjectContactsView): + queryset = Tunnel.objects.all() # # Tunnel terminations