Просмотр исходного кода

Merge pull request #18491 from antoinekh/17542-Contact_Assignment_to_vpn_tunnels

#17542 contact assignment to vpn tunnels
bctiemann 11 месяцев назад
Родитель
Сommit
a8b4024016
2 измененных файлов с 13 добавлено и 3 удалено
  1. 3 3
      netbox/vpn/models/tunnels.py
  2. 10 0
      netbox/vpn/views.py

+ 3 - 3
netbox/vpn/models/tunnels.py

@@ -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,

+ 10 - 0
netbox/vpn/views.py

@@ -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
 #
 #