custom-fields - usage counters / related objects box #8171

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

Originally created by @ITJamie on GitHub (Jun 7, 2023).

Originally assigned to: @abhi1693 on GitHub.

NetBox version

v.3.5.3

Feature type

Change to existing functionality

Proposed functionality

when viewing a custom field's config details (https://demo.netbox.dev/extras/custom-fields/1/) it would be nice if it had a "related objects" list, showing how many times that field is used/set per object type.

example of related objects view is on the tenants page https://demo.netbox.dev/tenancy/tenants/1/

Use case

when deprecating a custom field, it would be nice if the ui showed any existing usage of a field has been cleaned up

its also useful to see how popular certain custom fields are

Database changes

unknown

External dependencies

unknown

Originally created by @ITJamie on GitHub (Jun 7, 2023). Originally assigned to: @abhi1693 on GitHub. ### NetBox version v.3.5.3 ### Feature type Change to existing functionality ### Proposed functionality when viewing a custom field's config details (https://demo.netbox.dev/extras/custom-fields/1/) it would be nice if it had a "related objects" list, showing how many times that field is used/set per object type. example of related objects view is on the tenants page https://demo.netbox.dev/tenancy/tenants/1/ ### Use case when deprecating a custom field, it would be nice if the ui showed any existing usage of a field has been cleaned up its also useful to see how popular certain custom fields are ### Database changes unknown ### External dependencies unknown
adam added the status: acceptedtype: feature labels 2025-12-29 20:33:24 +01:00
adam closed this issue 2025-12-29 20:33:25 +01:00
Author
Owner

@jeremystretch commented on GitHub (Jun 14, 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 (Jun 14, 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

@ITJamie commented on GitHub (Jun 19, 2023):

more implementation details:

call netbox/templates/inc/panels/related_objects.html from netbox/templates/extras/customfield.html to add the related_objects panel.

the viewset for the custom field CustomFieldView would need to be extended with get_extra_content and the search logic added for each model to search for objects where the custom field is used ( content_types on the CustomField model could be used as a source for limiting the number of models searched )

eg:

    def get_extra_context(self, request, instance):
        related_models = (
        <model lookups here>
        )

        return {
            'related_models': related_models,
        }

the main purpose being able to see the usage of the custom field when on the custom field view

@ITJamie commented on GitHub (Jun 19, 2023): more implementation details: call `netbox/templates/inc/panels/related_objects.html` from `netbox/templates/extras/customfield.html` to add the related_objects panel. the viewset for the custom field `CustomFieldView` would need to be extended with `get_extra_content` and the search logic added for each model to search for objects where the custom field is used ( `content_types` on the CustomField model could be used as a source for limiting the number of models searched ) eg: ``` def get_extra_context(self, request, instance): related_models = ( <model lookups here> ) return { 'related_models': related_models, } ``` the main purpose being able to see the usage of the custom field when on the custom field view
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#8171