Skip to content

Commit 5d36281

Browse files
Antoine Keranflec'hbctiemann
authored andcommitted
fix(17542) add contact to tunnels
1 parent 6bc9302 commit 5d36281

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

netbox/vpn/models/tunnels.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from django.utils.translation import gettext_lazy as _
77

88
from netbox.models import ChangeLoggedModel, OrganizationalModel, PrimaryModel
9-
from netbox.models.features import CustomFieldsMixin, CustomLinksMixin, TagsMixin
9+
from netbox.models.features import CustomFieldsMixin, CustomLinksMixin, TagsMixin, ContactsMixin
1010
from vpn.choices import *
1111

1212
__all__ = (
@@ -16,7 +16,7 @@
1616
)
1717

1818

19-
class TunnelGroup(OrganizationalModel):
19+
class TunnelGroup(ContactsMixin, OrganizationalModel):
2020
"""
2121
An administrative grouping of Tunnels. This can be used to correlate peer-to-peer tunnels which form a mesh,
2222
for example.
@@ -27,7 +27,7 @@ class Meta:
2727
verbose_name_plural = _('tunnel groups')
2828

2929

30-
class Tunnel(PrimaryModel):
30+
class Tunnel(ContactsMixin, PrimaryModel):
3131
name = models.CharField(
3232
verbose_name=_('name'),
3333
max_length=100,

netbox/vpn/views.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ class TunnelGroupBulkDeleteView(generic.BulkDeleteView):
6767
filterset = filtersets.TunnelGroupFilterSet
6868
table = tables.TunnelGroupTable
6969

70+
@register_model_view(Tunnel, 'contacts')
71+
class TunnelGroupContactsView(ObjectContactsView):
72+
queryset = TunnelGroup.objects.all()
7073

7174
#
7275
# Tunnels
@@ -131,6 +134,9 @@ class TunnelBulkDeleteView(generic.BulkDeleteView):
131134
filterset = filtersets.TunnelFilterSet
132135
table = tables.TunnelTable
133136

137+
@register_model_view(Tunnel, 'contacts')
138+
class TunnelContactsView(ObjectContactsView):
139+
queryset = Tunnel.objects.all()
134140

135141
#
136142
# Tunnel terminations

0 commit comments

Comments
 (0)