Jeremy Stretch 3 месяцев назад
Родитель
Сommit
4d5f8e9460
2 измененных файлов с 24 добавлено и 2 удалено
  1. 11 2
      netbox/dcim/views.py
  2. 13 0
      netbox/netbox/ui/panels.py

+ 11 - 2
netbox/dcim/views.py

@@ -18,7 +18,9 @@ from ipam.models import ASN, IPAddress, Prefix, VLANGroup, VLAN
 from ipam.tables import InterfaceVLANTable, VLANTranslationRuleTable
 from netbox.object_actions import *
 from netbox.ui import layout
-from netbox.ui.panels import CommentsPanel, CustomFieldsPanel, ImageAttachmentsPanel, RelatedObjectsPanel, TagsPanel
+from netbox.ui.panels import (
+    CommentsPanel, CustomFieldsPanel, ImageAttachmentsPanel, PluginContentPanel, RelatedObjectsPanel, TagsPanel,
+)
 from netbox.views import generic
 from utilities.forms import ConfirmationForm
 from utilities.paginator import EnhancedPaginator, get_paginate_count
@@ -473,12 +475,19 @@ class SiteView(GetRelatedModelsMixin, generic.ObjectView):
                 CustomFieldsPanel(),
                 TagsPanel(),
                 CommentsPanel(),
+                PluginContentPanel('left_page'),
             ),
             layout.Column(
                 RelatedObjectsPanel(),
                 ImageAttachmentsPanel(),
+                PluginContentPanel('right_page'),
             ),
-        )
+        ),
+        layout.Row(
+            layout.Column(
+                PluginContentPanel('full_width_page'),
+            ),
+        ),
     )
 
     def get_extra_context(self, request, instance):

+ 13 - 0
netbox/netbox/ui/panels.py

@@ -6,6 +6,7 @@ from django.utils.translation import gettext_lazy as _
 from netbox.ui import attrs
 from netbox.ui.attrs import Attr
 from utilities.string import title
+from utilities.templatetags.plugins import _get_registered_content
 
 __all__ = (
     'CommentsPanel',
@@ -15,6 +16,7 @@ __all__ = (
     'ObjectPanel',
     'RelatedObjectsPanel',
     'Panel',
+    'PluginContentPanel',
     'TagsPanel',
 )
 
@@ -142,3 +144,14 @@ class ImageAttachmentsPanel(Panel):
             'request': context.get('request'),
             'object': context.get('object'),
         })
+
+
+class PluginContentPanel(Panel):
+
+    def __init__(self, method, **kwargs):
+        super().__init__(**kwargs)
+        self.method = method
+
+    def render(self, context):
+        obj = context.get('object')
+        return _get_registered_content(obj, self.method, context)