mirror of
https://github.com/netbox-community/netbox.git
synced 2026-02-06 07:16:25 -06:00
Closes #16359: Add navbar() method to PluginTemplateExtension
This commit is contained in:
@@ -22,7 +22,7 @@ def _get_registered_content(obj, method, template_context):
|
||||
'perms': template_context['perms'],
|
||||
}
|
||||
|
||||
model_name = obj._meta.label_lower
|
||||
model_name = obj._meta.label_lower if obj is not None else None
|
||||
template_extensions = registry['plugins']['template_extensions'].get(model_name, [])
|
||||
for template_extension in template_extensions:
|
||||
|
||||
@@ -43,6 +43,14 @@ def _get_registered_content(obj, method, template_context):
|
||||
return mark_safe(html)
|
||||
|
||||
|
||||
@register.simple_tag(takes_context=True)
|
||||
def plugin_navbar(context):
|
||||
"""
|
||||
Render any navbar content embedded by plugins
|
||||
"""
|
||||
return _get_registered_content(None, 'navbar', context)
|
||||
|
||||
|
||||
@register.simple_tag(takes_context=True)
|
||||
def plugin_buttons(context, obj):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user