Allow plugins to add columns to tables #8805

Closed
opened 2025-12-29 20:41:28 +01:00 by adam · 4 comments
Owner

Originally created by @rixx on GitHub (Nov 2, 2023).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

dev / v3.6.3

Feature type

New functionality

Proposed functionality

Allow plugins to register columns for built-in NetBox tables.

Use case

NetBox comes with admirably configurable tables and filters for all its built-in models, and makes it easy for plugins to provide tables like that, too. Some plugins manage fairly separate data, like DNS. However, when plugins connect to built-in models (instead of just providing separate models), the additional data cannot be seen from the built-in tables.

This is especially jarring for users when the data can be shown on the detail pages (by way of the template_extensions mechanism). Naturally, users tend to ask for ways to use the data displayed on the detail pages in the list/table views. As a plugin developer, I frequently build models that attach to existing NetBox models, and I get those requests a lot ("why do I have to go to the detail page of the Tenant to see the new data, can't you show it in the Tenant list?").

(I realise that there are technically ways to add columns to the tables right now: You can subclass/extend the built-in tables and provide them at a different URL, or, worst-of-all-worlds, patch something in. However, I think both of these are terrible in terms of maintainability and generally not good practice.)

An example could be a plugin that extends the customer management side of NetBox with additional data on Contacts, Tenants, or Sites, and would like to a) show the added data in those tables (e.g. the Site table), but also in other tables that can show Site information, e.g. the Device table.

I realise this isn't a trivial request. If you think this is generally worthwhile, I'd be happy to work on this feature!

Database changes

No response

External dependencies

No response

Originally created by @rixx on GitHub (Nov 2, 2023). Originally assigned to: @jeremystretch on GitHub. ### NetBox version dev / v3.6.3 ### Feature type New functionality ### Proposed functionality Allow plugins to register columns for built-in NetBox tables. ### Use case NetBox comes with admirably configurable tables and filters for all its built-in models, and makes it easy for plugins to provide tables like that, too. Some plugins manage fairly separate data, like DNS. However, when plugins *connect* to built-in models (instead of just providing separate models), the additional data cannot be seen from the built-in tables. This is especially jarring for users when the data *can* be shown on the detail pages (by way of the `template_extensions` mechanism). Naturally, users tend to ask for ways to use the data displayed on the detail pages in the list/table views. As a plugin developer, I frequently build models that attach to existing NetBox models, and I get those requests a lot ("why do I have to go to the detail page of the Tenant to see the new data, can't you show it in the Tenant list?"). (I realise that there are *technically* ways to add columns to the tables right now: You can subclass/extend the built-in tables and provide them at a different URL, or, worst-of-all-worlds, patch something in. However, I think both of these are terrible in terms of maintainability and generally not good practice.) An example could be a plugin that extends the customer management side of NetBox with additional data on Contacts, Tenants, or Sites, and would like to a) show the added data in those tables (e.g. the Site table), but also in other tables that can show Site information, e.g. the Device table. I realise this isn't a trivial request. If you think this is generally worthwhile, I'd be happy to work on this feature! ### Database changes _No response_ ### External dependencies _No response_
adam added the status: acceptedtype: featuretopic: plugins labels 2025-12-29 20:41:28 +01:00
adam closed this issue 2025-12-29 20:41:28 +01:00
Author
Owner

@jeremystretch commented on GitHub (Nov 6, 2023):

Thank you for your interest in extending NetBox. Unfortunately, the information you have provided does not constitute an actionable feature request. Per our contributing guide, a feature request must include a thorough description of the proposed functionality, including any database changes, new views or API endpoints, and so on. It must also include a detailed use case justifying its implementation. If you would like to elaborate on your proposal, please modify your post above. If sufficient detail is not added, this issue will be closed.

@jeremystretch commented on GitHub (Nov 6, 2023): Thank you for your interest in extending NetBox. Unfortunately, the information you have provided does not constitute an actionable feature request. Per our [contributing guide](https://github.com/netbox-community/netbox/blob/develop/CONTRIBUTING.md), a feature request must include a thorough description of the proposed functionality, including any database changes, new views or API endpoints, and so on. It must also include a detailed use case justifying its implementation. If you would like to elaborate on your proposal, please modify your post above. If sufficient detail is not added, this issue will be closed.
Author
Owner

@rixx commented on GitHub (Nov 7, 2023):

Apologies – updated the ticket with a longer description.

@rixx commented on GitHub (Nov 7, 2023): Apologies – updated the ticket with a longer description.
Author
Owner

@ITJamie commented on GitHub (Nov 9, 2023):

to give a very specific example of how this could be used for the netbox-gateways plugin.

the plugin could "register" that It should show related gateways objects on the prefix core module.
so it would add a "gateway" column to the prefix tables and maybe even a "gateway" field on the prefix API serializer for general API use.

being able to virtually extend the core module tables/api replys with extra data (possibly similar to how custom fields are presented in their own small dictionary) would be a fantastic feature to make plugins feel more connected to the core models they are integrating with.

@ITJamie commented on GitHub (Nov 9, 2023): to give a very specific example of how this could be used for the netbox-gateways plugin. the plugin could "register" that It should show related gateways objects on the prefix core module. so it would add a "gateway" column to the prefix tables and maybe even a "gateway" field on the prefix API serializer for general API use. being able to virtually extend the core module tables/api replys with extra data (possibly similar to how custom fields are presented in their own small dictionary) would be a fantastic feature to make plugins feel more connected to the core models they are integrating with.
Author
Owner

@jeremystretch commented on GitHub (Nov 10, 2023):

I did some quick digging and the base Table class from django-tables2 supports an extra_columns keyword argument that can be used to add, well, extra columns to a table. (This is the same mechanism we leverage to register columns for custom fields today.) We can override this in the init method of our own NetBoxTable class and inject columns that have been registered by plugins.

@jeremystretch commented on GitHub (Nov 10, 2023): I did some quick digging and the [base Table class](https://django-tables2.readthedocs.io/en/latest/pages/api-reference.html#table) from django-tables2 supports an `extra_columns` keyword argument that can be used to add, well, extra columns to a table. (This is the same mechanism we leverage to register columns for custom fields today.) We can override this in the init method of our own NetBoxTable class and inject columns that have been registered by plugins.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#8805