Establish a central registry for tracking the application of features (e.g. webhooks, custom links) to models #3480

Closed
opened 2025-12-29 18:29:26 +01:00 by adam · 0 comments
Owner

Originally created by @jeremystretch on GitHub (Mar 13, 2020).

Proposed Changes

Establish an internal registry to use for tracking which models within NetBox support which features. This should be similar in nature to the way Django registers models for its admin site. (Currently, this is accomplished through the use of several constants which each define a QuerySet filter returning the appropriate models.)

This proposal does NOT effect any changes to the assignment of these features. It is an internal change only.

Justification

Employing a central registry obviates the need to maintain explicit lists of models and simplifies the registration process. We could use a decorator, such as:

@register('webhooks', 'custom_links')
class Foo(models.model):
    ...
Originally created by @jeremystretch on GitHub (Mar 13, 2020). ### Proposed Changes Establish an internal registry to use for tracking which models within NetBox support which features. This should be similar in nature to the way Django registers models for its admin site. (Currently, this is accomplished through the use of several constants which each define a QuerySet filter returning the appropriate models.) This proposal does NOT effect any changes to the assignment of these features. It is an internal change only. ### Justification Employing a central registry obviates the need to maintain explicit lists of models and simplifies the registration process. We could use a decorator, such as: ```python @register('webhooks', 'custom_links') class Foo(models.model): ... ```
adam added the status: acceptedtype: housekeeping labels 2025-12-29 18:29:26 +01:00
adam closed this issue 2025-12-29 18:29:26 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#3480