Enable plugins to inject content within object list views #3775

Closed
opened 2025-12-29 18:31:10 +01:00 by adam · 9 comments
Owner

Originally created by @JulianJacobi on GitHub (Jun 12, 2020).

Originally assigned to: @arthanson on GitHub.

Environment

  • Python version: 3.7
  • NetBox version: 2.8.0

Proposed Functionality

It would be nice to give plugins the capability to not only inject buttons in object detail views, but also inject buttons to object list views.

Use Case

My specific use case is to add an additional button to object list view to give options to preseed the object form with automatically generated values, like in our case names, that follows the company's naming convention.

Here a little example screenshot:
Bildschirmfoto 2020-06-12 um 11 57 30

Database Changes

None.

External Dependencies

None.

Originally created by @JulianJacobi on GitHub (Jun 12, 2020). Originally assigned to: @arthanson on GitHub. <!-- NOTE: IF YOUR ISSUE DOES NOT FOLLOW THIS TEMPLATE, IT WILL BE CLOSED. This form is only for proposing specific new features or enhancements. If you have a general idea or question, please post to our mailing list instead of opening an issue: https://groups.google.com/forum/#!forum/netbox-discuss NOTE: Due to an excessive backlog of feature requests, we are not currently accepting any proposals which significantly extend NetBox's feature scope. Please describe the environment in which you are running NetBox. Be sure that you are running an unmodified instance of the latest stable release before submitting a bug report. --> ### Environment * Python version: 3.7 * NetBox version: 2.8.0 <!-- Describe in detail the new functionality you are proposing. Include any specific changes to work flows, data models, or the user interface. --> ### Proposed Functionality It would be nice to give plugins the capability to not only inject buttons in object detail views, but also inject buttons to object list views. <!-- Convey an example use case for your proposed feature. Write from the perspective of a NetBox user who would benefit from the proposed functionality and describe how. ---> ### Use Case My specific use case is to add an additional button to object list view to give options to preseed the object form with automatically generated values, like in our case names, that follows the company's naming convention. Here a little example screenshot: <img width="473" alt="Bildschirmfoto 2020-06-12 um 11 57 30" src="https://user-images.githubusercontent.com/3304773/84490916-167b1300-aca4-11ea-911a-2d3932eb103e.png"> <!-- Note any changes to the database schema necessary to support the new feature. For example, does the proposal require adding a new model or field? (Not all new features require database changes.) ---> ### Database Changes None. <!-- List any new dependencies on external libraries or services that this new feature would introduce. For example, does the proposal require the installation of a new Python package? (Not all new features introduce new dependencies.) --> ### External Dependencies None.
adam added the status: acceptedtype: featuretopic: plugins labels 2025-12-29 18:31:10 +01:00
adam closed this issue 2025-12-29 18:31:10 +01:00
Author
Owner

@jeremystretch commented on GitHub (Jun 12, 2020):

It would be nice to give plugins the capability to not only inject buttons in object detail views, but also inject buttons to object list views.

Please expand your issue to specify exactly what changes you are proposing, including example code that a plugin would use.

@jeremystretch commented on GitHub (Jun 12, 2020): > It would be nice to give plugins the capability to not only inject buttons in object detail views, but also inject buttons to object list views. Please expand your issue to specify exactly what changes you are proposing, including example code that a plugin would use.
Author
Owner

@JulianJacobi commented on GitHub (Jun 12, 2020):

I would add an additional method to PluginTemplateExtension called list_buttons() that acts similar to buttons() but is not rendered in an object's detail view context but in object's list view.

Plugin example code could be:

from extras.plugins import PluginTemplateExtension

class DeviceListButton(PluginTemplateExtension):
    model = 'dcim.device'

    def list_buttons(self):
        return self.render('sample_netbox_plugin/inc/device_list_buttons.html')

template_extensions = [DeviceListButton]
@JulianJacobi commented on GitHub (Jun 12, 2020): I would add an additional method to `PluginTemplateExtension` called `list_buttons()` that acts similar to `buttons()` but is not rendered in an object's detail view context but in object's list view. Plugin example code could be: ```python from extras.plugins import PluginTemplateExtension class DeviceListButton(PluginTemplateExtension): model = 'dcim.device' def list_buttons(self): return self.render('sample_netbox_plugin/inc/device_list_buttons.html') template_extensions = [DeviceListButton] ```
Author
Owner

@JulianJacobi commented on GitHub (Jun 24, 2020):

If this would help, I can provide an implementation attempt.

@JulianJacobi commented on GitHub (Jun 24, 2020): If this would help, I can provide an implementation attempt.
Author
Owner

@ozoid commented on GitHub (Jun 29, 2020):

I too would like to see this feature - along with plugin buttons/areas on the interface view - there are some already on the cable view.
p.s. custom fields on interfaces would also be great (https://nifry.com/2020/06/08/custom-fields-on-netbox-interfaces/)
Thank you :-)

@ozoid commented on GitHub (Jun 29, 2020): I too would like to see this feature - along with plugin buttons/areas on the interface view - there are some already on the cable view. p.s. custom fields on interfaces would also be great (https://nifry.com/2020/06/08/custom-fields-on-netbox-interfaces/) Thank you :-)
Author
Owner

@hellerve commented on GitHub (Jul 22, 2020):

i think this sounds fantastic. What feedback needs to be gathered still?

@hellerve commented on GitHub (Jul 22, 2020): i think this sounds fantastic. What feedback needs to be gathered still?
Author
Owner

@jeremystretch commented on GitHub (Jul 24, 2020):

What functionality would the buttons provide? Keep in mind that they would not be part of the object selection list: you would not be able to select a few objects and then perform some plugin action, for instance. Bearing this in mind, maybe generic "list header" and "list footer" inclusions would make more sense?

@jeremystretch commented on GitHub (Jul 24, 2020): What functionality would the buttons provide? Keep in mind that they would not be part of the object selection list: you would not be able to select a few objects and then perform some plugin action, for instance. Bearing this in mind, maybe generic "list header" and "list footer" inclusions would make more sense?
Author
Owner

@JulianJacobi commented on GitHub (Jul 24, 2020):

In out (maybe a little bit special) use case, we want to add "shortcuts" to the object creation form with a (vie GET-parameters) preseeded, autogenerated object name. So we can easily create the next unused name that follows a special naming convention, without the need to copy&paste things from netbox to netbox.

So for this use case a button near the "Add" button makes the most sense. But i think i got you point and if you don't want to support both options (what i could understand) i think list header and footer buttons would make more sense in a more generic point of view.

@JulianJacobi commented on GitHub (Jul 24, 2020): In out (maybe a little bit special) use case, we want to add "shortcuts" to the object creation form with a (vie GET-parameters) preseeded, autogenerated object name. So we can easily create the next unused name that follows a special naming convention, without the need to copy&paste things from netbox to netbox. So for this use case a button near the "Add" button makes the most sense. But i think i got you point and if you don't want to support both options (what i could understand) i think list header and footer buttons would make more sense in a more generic point of view.
Author
Owner

@ozoid commented on GitHub (Aug 6, 2020):

A plugin button on the interface view would allow our plugin to pull/push the data for the specific interface (Observium/SNMP)
We could also link to the interface charts/detail page on our monitoring systems.
We have added the custom fields for interfaces to allow us to store the monitoring system interface UID.
Content areas could allow us to augment the interface view with more data/charts/stats.
The cable detail page allows plugin buttons - we have been using another system for our cable database - buttons here allow us to pull in that data - popup some questions - and update the details from the other system (temporary solution).
overall we are extremely impressed with netbox, I would like to see our whole infrastructure detailed - but getting 2 DCs worth of data into netbox is not just a simple import task, hence the plugin to connect our systems and slowly import/update/push to our devices.

@ozoid commented on GitHub (Aug 6, 2020): A plugin button on the interface view would allow our plugin to pull/push the data for the specific interface (Observium/SNMP) We could also link to the interface charts/detail page on our monitoring systems. We have added the custom fields for interfaces to allow us to store the monitoring system interface UID. Content areas could allow us to augment the interface view with more data/charts/stats. The cable detail page allows plugin buttons - we have been using another system for our cable database - buttons here allow us to pull in that data - popup some questions - and update the details from the other system (temporary solution). overall we are extremely impressed with netbox, I would like to see our whole infrastructure detailed - but getting 2 DCs worth of data into netbox is not just a simple import task, hence the plugin to connect our systems and slowly import/update/push to our devices.
Author
Owner

@jeremystretch commented on GitHub (Sep 1, 2020):

I've modified the title of this proposal to be more generic, rather than focusing specifically on buttons.

I'm marking this tentatively accepted (pending milestone assignment) with the assumption that its implementation will be limited to extending the current feature to also support list views.

@jeremystretch commented on GitHub (Sep 1, 2020): I've modified the title of this proposal to be more generic, rather than focusing specifically on buttons. I'm marking this tentatively accepted (pending milestone assignment) with the assumption that its implementation will be limited to extending [the current feature](https://netbox.readthedocs.io/en/stable/plugins/development/#extending-core-templates) to also support list views.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#3775