Make the "Related Objects" pane in the detail view for "Tenant" extensible #8630

Closed
opened 2025-12-29 20:39:06 +01:00 by adam · 3 comments
Owner

Originally created by @peteeckel on GitHub (Sep 18, 2023).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

v3.6.1

Feature type

Change to existing functionality

Proposed functionality

On the right side of the detail view for a "Tenant" object there is a list of NetBox core models and object counts the tenant is assigned to. Currently the list of models in this view is hardcoded in tenancy.TenantView.get_extra_content().

It would be helpful for plugins supporting tenancy if that list could be extended, e.g. by providing a decorator that could be applied to models using tenancy similar to the mechanism used for the global search index.

Use case

In many cases it makes sense for plugins to use tenancy to indicate the ownership of or responsibility for objects, making it easier to filter for objects related, for instance, to a specific customer or department.

While tenancy itself is easy to implement, this does not reflect in the list of related objects for a tenant. The detail view for a tenant only shows NetBox core objects that are assigned to the tenant, not objects of plugin models.

This is especially annoying when a user wants to delete a tenant object, which is usually related to the target object using the referential integrity option models.PROTECT. So even if there are no related objects shown in the tenant view, the tenant still can't be deleted because there are unlisted objects still owned by it in the plugin's models.

Database changes

Unknown, probably none - depending on how this can be implemented.

External dependencies

None.

Originally created by @peteeckel on GitHub (Sep 18, 2023). Originally assigned to: @jeremystretch on GitHub. ### NetBox version v3.6.1 ### Feature type Change to existing functionality ### Proposed functionality On the right side of the detail view for a "Tenant" object there is a list of NetBox core models and object counts the tenant is assigned to. Currently the list of models in this view is hardcoded in `tenancy.TenantView.get_extra_content()`. It would be helpful for plugins supporting tenancy if that list could be extended, e.g. by providing a decorator that could be applied to models using tenancy similar to the mechanism used for the global search index. ### Use case In many cases it makes sense for plugins to use tenancy to indicate the ownership of or responsibility for objects, making it easier to filter for objects related, for instance, to a specific customer or department. While tenancy itself is easy to implement, this does not reflect in the list of related objects for a tenant. The detail view for a tenant only shows NetBox core objects that are assigned to the tenant, not objects of plugin models. This is especially annoying when a user wants to delete a tenant object, which is usually related to the target object using the referential integrity option `models.PROTECT`. So even if there are no related objects shown in the tenant view, the tenant still can't be deleted because there are unlisted objects still owned by it in the plugin's models. ### Database changes Unknown, probably none - depending on how this can be implemented. ### External dependencies None.
adam added the status: acceptedtype: feature labels 2025-12-29 20:39:06 +01:00
adam closed this issue 2025-12-29 20:39:06 +01:00
Author
Owner

@abhi1693 commented on GitHub (Sep 18, 2023):

this does not reflect in the list of related objects for a tenant.

You can use the template content or tab view to inject the additional views which will help with your use case.

@abhi1693 commented on GitHub (Sep 18, 2023): > this does not reflect in the list of related objects for a tenant. You can use the template content or tab view to inject the additional views which will help with your use case.
Author
Owner

@peteeckel commented on GitHub (Sep 18, 2023):

Yes, adding a tab or an additional pane via template content (eventually it became the latter as that's less diverting from the original contents of the view) was actually what I had in mind as a workaround.

@peteeckel commented on GitHub (Sep 18, 2023): Yes, adding a tab or an additional pane via template content (eventually it became the latter as that's less diverting from the original contents of the view) was actually what I had in mind as a workaround.
Author
Owner

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

Rather than requiring other models to register explicitly, we should be able to infer many-to-one relationships from the Tenant model, and display the object count for each.

@jeremystretch commented on GitHub (Nov 6, 2023): Rather than requiring other models to register explicitly, we should be able to infer many-to-one relationships from the Tenant model, and display the object count for each.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#8630