Custom fields on more models #2525

Closed
opened 2025-12-29 18:19:39 +01:00 by adam · 2 comments
Owner

Originally created by @candlerb on GitHub (Apr 18, 2019).

Environment

  • Python version: 3.5.2
  • NetBox version: 2.5.10

Proposed Functionality

Allow custom fields to be added to:

  • dcim_devicerole
  • dcim_inventoryitem

Use Case

On dcim_devicerole: add contact details for responsible team

On dcim_inventoryitem: add purchase date, warranty expiry, usage (e.g. OS disk / data disk), capacity, form factor (2.5"/3.5")

Database Changes

None that I can see: extras_customfield can link to any django_content_type.

External Dependencies

None

Originally created by @candlerb on GitHub (Apr 18, 2019). ### Environment * Python version: 3.5.2 * NetBox version: 2.5.10 ### Proposed Functionality Allow custom fields to be added to: * dcim_devicerole * dcim_inventoryitem ### Use Case On dcim_devicerole: add contact details for responsible team On dcim_inventoryitem: add purchase date, warranty expiry, usage (e.g. OS disk / data disk), capacity, form factor (2.5"/3.5") ### Database Changes None that I can see: `extras_customfield` can link to any `django_content_type`. ### External Dependencies None
adam closed this issue 2025-12-29 18:19:39 +01:00
Author
Owner

@jeremystretch commented on GitHub (Apr 18, 2019):

Custom fields are only supported on primary models for performance reasons. The FAQ offers more context on this.

@jeremystretch commented on GitHub (Apr 18, 2019): Custom fields are only supported on primary models for performance reasons. [The FAQ](https://github.com/digitalocean/netbox/wiki/Frequently-Asked-Questions#can-we-add-custom-fields-to-more-models) offers more context on this.
Author
Owner

@paravoid commented on GitHub (Apr 22, 2019):

Would it perhaps meaningful to use a JSONField (PostgreSQL's jsonb) instead for those cases? It would allow for reading these without extra queries (and thus show up in the listing), as well as searches in them. On the flip side I suppose it would make validation and multiple-choices fields more difficult.

I came across this task while looking on how to add a couple of our custom fields (e.g. ticket number) to inventory items like Juniper linecards.

@paravoid commented on GitHub (Apr 22, 2019): Would it perhaps meaningful to use a JSONField (PostgreSQL's jsonb) instead for those cases? It would allow for reading these without extra queries (and thus show up in the listing), as well as searches in them. On the flip side I suppose it would make validation and multiple-choices fields more difficult. I came across this task while looking on how to add a couple of our custom fields (e.g. ticket number) to inventory items like Juniper linecards.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#2525