From 4d5f8e946090fe00b3eda503f81757b2647b7d52 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Fri, 31 Oct 2025 14:50:21 -0400 Subject: [PATCH] Add PluginContentPanel --- netbox/dcim/views.py | 13 +++++++++++-- netbox/netbox/ui/panels.py | 13 +++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/netbox/dcim/views.py b/netbox/dcim/views.py index 5b1923b08..3d0672019 100644 --- a/netbox/dcim/views.py +++ b/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): diff --git a/netbox/netbox/ui/panels.py b/netbox/netbox/ui/panels.py index 96061d42e..3948f0de4 100644 --- a/netbox/netbox/ui/panels.py +++ b/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)