1
0
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:
Arthur Hanson
2022-11-14 10:51:58 -08:00
committed by GitHub
parent a57c937aaa
commit 27bf7b4a9a
5 changed files with 28 additions and 1 deletions

View File

@@ -187,11 +187,16 @@ Plugins can inject custom content into certain areas of the detail views of appl
* `full_width_page()` - Inject content across the entire bottom of the page
* `buttons()` - Add buttons to the top of the page
Plugins can also inject custom content into certain areas of the list views of applicable models using the same subclass of `PluginTemplateExtension`. One method is available:
* `list_buttons()` - Add buttons to the top of the list view page
Additionally, a `render()` method is available for convenience. This method accepts the name of a template to render, and any additional context data you want to pass. Its use is optional, however.
When a PluginTemplateExtension is instantiated, context data is assigned to `self.context`. Available data include:
* `object` - The object being viewed
* `object` - The object being viewed (for detail views only)
* `model` - The model of the list view (for list views only)
* `request` - The current request
* `settings` - Global NetBox settings
* `config` - Plugin-specific configuration parameters