Min/max values for decimal custom fields must be an integer #11387

Closed
opened 2025-12-29 21:44:30 +01:00 by adam · 2 comments
Owner

Originally created by @jeremystretch on GitHub (Jul 16, 2025).

Originally assigned to: @Jathn on GitHub.

Deployment Type

Self-hosted

NetBox Version

v4.3.4

Python Version

3.10

Steps to Reproduce

  1. Open the form to create a new custom field
  2. Select an object type and give it a name
  3. Set the field type to "decimal"
  4. Set the maximum value for the field to 1.5
  5. Submit the form

Expected Behavior

The custom field should be created, with a maximum value of 1.5.

Observed Behavior

Form validation fails, with the error "Enter a whole number."

Originally created by @jeremystretch on GitHub (Jul 16, 2025). Originally assigned to: @Jathn on GitHub. ### Deployment Type Self-hosted ### NetBox Version v4.3.4 ### Python Version 3.10 ### Steps to Reproduce 1. Open the form to create a new custom field 2. Select an object type and give it a name 3. Set the field type to "decimal" 4. Set the maximum value for the field to 1.5 5. Submit the form ### Expected Behavior The custom field should be created, with a maximum value of 1.5. ### Observed Behavior Form validation fails, with the error "Enter a whole number."
adam added the type: bugstatus: acceptedseverity: low labels 2025-12-29 21:44:30 +01:00
adam closed this issue 2025-12-29 21:44:30 +01:00
Author
Owner

@Jathn commented on GitHub (Aug 27, 2025):

Hello,

I think the problem lies in that the validation fields in Customfield are defined as BigIntegerFields and not as DecimalFields, meaning they are automatically converted. Changing it would probably require some fine tuning of "max_digits" and a new migration.

If this approach seems valid, then I could have a go.

@Jathn commented on GitHub (Aug 27, 2025): Hello, I think the problem lies in that the validation fields in Customfield are defined as BigIntegerFields and not as DecimalFields, meaning they are automatically converted. Changing it would probably require some fine tuning of "max_digits" and a new migration. If this approach seems valid, then I could have a go.
Author
Owner

@jeremystretch commented on GitHub (Aug 27, 2025):

Thanks @Jathn, I've assigned this to you! (Do note that changing the model field type will require introducing a database migration.)

@jeremystretch commented on GitHub (Aug 27, 2025): Thanks @Jathn, I've assigned this to you! (Do note that changing the model field type will require introducing a database migration.)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#11387