Implement Decimal and/or Float as a custom field data type #6975

Closed
opened 2025-12-29 19:47:22 +01:00 by adam · 0 comments
Owner

Originally created by @eronlloyd on GitHub (Sep 13, 2022).

Originally assigned to: @arthanson on GitHub.

NetBox version

v3.3.2

Feature type

Change to existing functionality

Proposed functionality

While the Integer custom field data type is usage for many use cases, there are others that require decimal or float precision.

I propose that one or both of these numeric types be added as choices for custom fields to enable such use cases. @jeremystretch pointed out that the underlying JSON serialization would have to be taken into consideration for the different types as JSON doesn't distinguish between numerical types. This constraint may make sticking with Decimal the better option to preserve precision.

Use case

As an example, I'm trying to create custom fields for optical insertion loss (IL) for ports and attenuation for cables, but this needs to be in decimal format to accurately represent the decibel values.

Database changes

Stored as JSON in the DB, so shouldn't affect the data model. Requires changes when serialized/de-serialized into memory.

External dependencies

None

Originally created by @eronlloyd on GitHub (Sep 13, 2022). Originally assigned to: @arthanson on GitHub. ### NetBox version v3.3.2 ### Feature type Change to existing functionality ### Proposed functionality While the Integer custom field data type is usage for many use cases, there are others that require decimal or float precision. I propose that one or both of these numeric types be added as choices for custom fields to enable such use cases. @jeremystretch pointed out that the underlying JSON serialization would have to be taken into consideration for the different types as JSON doesn't distinguish between numerical types. This constraint may make sticking with Decimal the better option to preserve precision. ### Use case As an example, I'm trying to create custom fields for optical insertion loss (IL) for ports and attenuation for cables, but this needs to be in decimal format to accurately represent the decibel values. ### Database changes Stored as JSON in the DB, so shouldn't affect the data model. Requires changes when serialized/de-serialized into memory. ### External dependencies None
adam added the status: acceptedtype: feature labels 2025-12-29 19:47:22 +01:00
adam closed this issue 2025-12-29 19:47:22 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#6975