mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
4751 Enable plugins to inject content within object list views (#10901)
* 4751 add plugin buttons to list templates * 4751 add plugin buttons to list templates * 4751 add documentation * 4751 fix object reference * 4751 update docs
This commit is contained in:
@@ -63,3 +63,11 @@ class PluginTemplateExtension:
|
||||
automatically handled.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def list_buttons(self):
|
||||
"""
|
||||
Buttons that will be rendered and added to the existing list of buttons on the list view. Content
|
||||
should be returned as an HTML string. Note that content does not need to be marked as safe because this is
|
||||
automatically handled.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
@@ -73,3 +73,11 @@ def plugin_full_width_page(context, obj):
|
||||
Render all full width page content registered by plugins
|
||||
"""
|
||||
return _get_registered_content(obj, 'full_width_page', context)
|
||||
|
||||
|
||||
@register.simple_tag(takes_context=True)
|
||||
def plugin_list_buttons(context, model):
|
||||
"""
|
||||
Render all list buttons registered by plugins
|
||||
"""
|
||||
return _get_registered_content(model, 'list_buttons', context)
|
||||
|
@@ -16,5 +16,8 @@ class SiteContent(PluginTemplateExtension):
|
||||
def buttons(self):
|
||||
return "SITE CONTENT - BUTTONS"
|
||||
|
||||
def list_buttons(self):
|
||||
return "SITE CONTENT - LIST BUTTONS"
|
||||
|
||||
|
||||
template_extensions = [SiteContent]
|
||||
|
Reference in New Issue
Block a user