-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Labels
type: housekeepingChanges to the application which do not directly impact the end userChanges to the application which do not directly impact the end user
Description
Proposed Changes
Currently, a NetBox model must meet two conditions for custom fields to function properly:
- Inherit from CustomFieldsMixin
- Register as having custom fields via the
extras_features()decorator
The second step is redundant, given that it should be assumed that any model inheriting from CustomFieldsMixin supports custom fields. However, failing to register via extras_features() excludes the model from the list of available models when creating a custom field, and from other such selections.
We can obviate the need to register the model explicitly by instead connecting a receiver function to Django's class_prepared signal and checking for custom field support on the class.
Justification
Eliminates redundant code and reduces the possibility for human error.
Metadata
Metadata
Assignees
Labels
type: housekeepingChanges to the application which do not directly impact the end userChanges to the application which do not directly impact the end user