Make the "Related Objects" pane of all models dynamic #9508

Closed
opened 2025-12-29 20:50:47 +01:00 by adam · 2 comments
Owner

Originally created by @alehaa on GitHub (Apr 20, 2024).

Originally assigned to: @alehaa on GitHub.

NetBox version

v3.7.5

Feature type

Change to existing functionality

Proposed functionality

In #13794, extending the "Related Objects" by other showing other models was requested and implemented by dynamically listing counts for all ManyToMany reverse relationships. Now, I'd like to copy this functionality to all other uses of the "Related Objects" pane,

Use case

As described in #13794, it might be useful for plugins to link their data to existing NetBox core models. However, this is not only useful for tenancy, but any object relationship could benefit from this.

A real life example is covered by the NetBox inventory plugin: Hardware assets are related to dcim.Device, dcim.Manufacturer, dcim.Site and dcim.Location. They would benefit from quick access to a list of related assets for these models. Right now an extra pane needs to be implemented, so there are actually two "Related Objects" panes per details page.

Also, this would make this feature work consistently across all views in NetBox, so the maintenance overhead should theoretically be reduced.

Database changes

None

External dependencies

None

Originally created by @alehaa on GitHub (Apr 20, 2024). Originally assigned to: @alehaa on GitHub. ### NetBox version v3.7.5 ### Feature type Change to existing functionality ### Proposed functionality In #13794, extending the "Related Objects" by other showing other models was requested and implemented by dynamically listing counts for all `ManyToMany` reverse relationships. Now, I'd like to copy this functionality to all other uses of the "Related Objects" pane, ### Use case As described in #13794, it might be useful for plugins to link their data to existing NetBox core models. However, this is not only useful for tenancy, but any object relationship could benefit from this. A real life example is covered by the [NetBox inventory](https://github.com/ArnesSI/netbox-inventory) plugin: Hardware assets are related to `dcim.Device`, `dcim.Manufacturer`, `dcim.Site` and `dcim.Location`. They would benefit from quick access to a list of related assets for these models. Right now an extra pane needs to be implemented, so there are actually two "Related Objects" panes per details page. Also, this would make this feature work consistently across all views in NetBox, so the maintenance overhead should theoretically be reduced. ### Database changes None ### External dependencies None
adam added the status: acceptedtype: featurecomplexity: medium labels 2025-12-29 20:50:47 +01:00
adam closed this issue 2025-12-29 20:50:48 +01:00
Author
Owner

@alehaa commented on GitHub (Apr 20, 2024):

I've already tested using the code from TenantView in other views and can provide a PR for the changes requested.

@alehaa commented on GitHub (Apr 20, 2024): I've already tested using the code from `TenantView` in other views and can provide a PR for the changes requested.
Author
Owner

@arthanson commented on GitHub (Apr 22, 2024):

@alehaa sounds good, I'll assign to you - Note: you should capture the existing logic into a reusable function (vs. copying and pasting the current get_extra_context() for TenantView)

@arthanson commented on GitHub (Apr 22, 2024): @alehaa sounds good, I'll assign to you - Note: you should capture the existing logic into a reusable function (vs. copying and pasting the current get_extra_context() for TenantView)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#9508