Plugin template extensions missing from VM interface view #4256

Closed
opened 2025-12-29 18:34:16 +01:00 by adam · 2 comments
Owner

Originally created by @minitriga on GitHub (Nov 9, 2020).

Originally assigned to: @jeremystretch on GitHub.

I'm currently writing netbox_graphs for the inevitable removal of graphs in 2.10 I have graphs functioning in Sites, Devices and Providers to keep the existing functionality of the current graph implementation but some templates do not support plugin buttons.

Environment

  • Python version: Python 3.7.7
  • NetBox version: v2.9.7

Steps to Reproduce

  1. Create template_content.py and add the following:
## Does not work needs fixing
class VirtualizationVMIntfGraphButton(PluginTemplateExtension):
    model = 'virtualization.vminterface'

    def buttons(self):
        return button_template(self)

## Does not work needs fixing
class IntfGraphButton(PluginTemplateExtension):
    model = 'dcim.interface'

    def button(self):
        return button_template(self)

template_extensions = [VirtualizationVMIntfGraphButton, IntfGraphButton]
  1. Buttons do not load due to vminterface.html and interface.html not containing plugin buttons.

Expected Behavior

Expected buttons to load.

Observed Behavior

No buttons are loaded.

Originally created by @minitriga on GitHub (Nov 9, 2020). Originally assigned to: @jeremystretch on GitHub. I'm currently writing netbox_graphs for the inevitable removal of graphs in `2.10` I have graphs functioning in Sites, Devices and Providers to keep the existing functionality of the current graph implementation but some templates do not support plugin buttons. ### Environment * Python version: Python 3.7.7 * NetBox version: v2.9.7 <!-- Describe in detail the exact steps that someone else can take to reproduce this bug using the current stable release of NetBox. Begin with the creation of any necessary database objects and call out every operation being performed explicitly. If reporting a bug in the REST API, be sure to reconstruct the raw HTTP request(s) being made: Don't rely on a client library such as pynetbox. --> ### Steps to Reproduce 1. Create template_content.py and add the following: ```python ## Does not work needs fixing class VirtualizationVMIntfGraphButton(PluginTemplateExtension): model = 'virtualization.vminterface' def buttons(self): return button_template(self) ## Does not work needs fixing class IntfGraphButton(PluginTemplateExtension): model = 'dcim.interface' def button(self): return button_template(self) template_extensions = [VirtualizationVMIntfGraphButton, IntfGraphButton] ``` 2. Buttons do not load due to `vminterface.html` and `interface.html` not containing plugin buttons. <!-- What did you expect to happen? --> ### Expected Behavior Expected buttons to load. <!-- What happened instead? --> ### Observed Behavior No buttons are loaded.
adam added the type: bugstatus: accepted labels 2025-12-29 18:34:16 +01:00
adam closed this issue 2025-12-29 18:34:16 +01:00
Author
Owner

@minitriga commented on GitHub (Nov 9, 2020):

#4349

Its very basic at the moment but here is the initial run through. https://github.com/minitriga/netbox-graphs

@minitriga commented on GitHub (Nov 9, 2020): #4349 Its very basic at the moment but here is the initial run through. https://github.com/minitriga/netbox-graphs
Author
Owner

@jeremystretch commented on GitHub (Nov 9, 2020):

Looks like the vminterface.html template never had the plugin_* template tags added to it for some reason.

## Does not work needs fixing
class IntfGraphButton(PluginTemplateExtension):
    model = 'dcim.interface'

    def button(self):
        return button_template(self)

def button() should be def buttons(), plural. Correcting this will render the content as expected.

@jeremystretch commented on GitHub (Nov 9, 2020): Looks like the `vminterface.html` template never had the `plugin_*` template tags added to it for some reason. ``` ## Does not work needs fixing class IntfGraphButton(PluginTemplateExtension): model = 'dcim.interface' def button(self): return button_template(self) ``` `def button()` should be `def buttons()`, plural. Correcting this will render the content as expected.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#4256