mirror of
https://github.com/netbox-community/netbox.git
synced 2026-01-17 09:12:18 -06:00
Add PluginContentPanel
This commit is contained in:
@@ -18,7 +18,9 @@ from ipam.models import ASN, IPAddress, Prefix, VLANGroup, VLAN
|
|||||||
from ipam.tables import InterfaceVLANTable, VLANTranslationRuleTable
|
from ipam.tables import InterfaceVLANTable, VLANTranslationRuleTable
|
||||||
from netbox.object_actions import *
|
from netbox.object_actions import *
|
||||||
from netbox.ui import layout
|
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 netbox.views import generic
|
||||||
from utilities.forms import ConfirmationForm
|
from utilities.forms import ConfirmationForm
|
||||||
from utilities.paginator import EnhancedPaginator, get_paginate_count
|
from utilities.paginator import EnhancedPaginator, get_paginate_count
|
||||||
@@ -473,12 +475,19 @@ class SiteView(GetRelatedModelsMixin, generic.ObjectView):
|
|||||||
CustomFieldsPanel(),
|
CustomFieldsPanel(),
|
||||||
TagsPanel(),
|
TagsPanel(),
|
||||||
CommentsPanel(),
|
CommentsPanel(),
|
||||||
|
PluginContentPanel('left_page'),
|
||||||
),
|
),
|
||||||
layout.Column(
|
layout.Column(
|
||||||
RelatedObjectsPanel(),
|
RelatedObjectsPanel(),
|
||||||
ImageAttachmentsPanel(),
|
ImageAttachmentsPanel(),
|
||||||
|
PluginContentPanel('right_page'),
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
|
layout.Row(
|
||||||
|
layout.Column(
|
||||||
|
PluginContentPanel('full_width_page'),
|
||||||
|
),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_extra_context(self, request, instance):
|
def get_extra_context(self, request, instance):
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ from django.utils.translation import gettext_lazy as _
|
|||||||
from netbox.ui import attrs
|
from netbox.ui import attrs
|
||||||
from netbox.ui.attrs import Attr
|
from netbox.ui.attrs import Attr
|
||||||
from utilities.string import title
|
from utilities.string import title
|
||||||
|
from utilities.templatetags.plugins import _get_registered_content
|
||||||
|
|
||||||
__all__ = (
|
__all__ = (
|
||||||
'CommentsPanel',
|
'CommentsPanel',
|
||||||
@@ -15,6 +16,7 @@ __all__ = (
|
|||||||
'ObjectPanel',
|
'ObjectPanel',
|
||||||
'RelatedObjectsPanel',
|
'RelatedObjectsPanel',
|
||||||
'Panel',
|
'Panel',
|
||||||
|
'PluginContentPanel',
|
||||||
'TagsPanel',
|
'TagsPanel',
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -142,3 +144,14 @@ class ImageAttachmentsPanel(Panel):
|
|||||||
'request': context.get('request'),
|
'request': context.get('request'),
|
||||||
'object': context.get('object'),
|
'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)
|
||||||
|
|||||||
Reference in New Issue
Block a user