Closed
Description
NetBox version
v4.0.6
Feature type
New functionality
Proposed functionality
A subclass of PluginTemplateExtension
must currently register against a single model. For example:
from netbox.plugins import PluginTemplateExtension
class SiteCustomContent(PluginTemplateExtension):
model = 'dcim.site'
This issue proposes adding an alternative models
attribute to specify an iterable of models. For example:
from netbox.plugins import PluginTemplateExtension
class SiteCustomContent(PluginTemplateExtension):
models = ['dcim.region', 'dcim.site', 'dcim.location']
The content introduced by this class will then be embedded on the relevant view for each of the listed models.
If models
is defined, it will take precedence over model
.
Use case
This obviates the need to create a redundant PluginTemplateExtension
subclass for each core model.
Database changes
None
External dependencies
None