'Django DecimalRangeField form validation will only accept whole numbers
All of my DecimalRangeField fields work as expected when changing values in admin but my form won't accept non-whole numbers:
Interestingly, if I set the lower default value as a non-whole number, the validation tries to force any whole number added to the lowest default. For example, if I define a field like this in models.py:
my_field= DecimalRangeField(
blank=True,
default=(0.05, 5),
validators=[RangeMinValueValidator(0.05), RangeMaxValueValidator(5)],
)
I get the following warning:
Maybe I am missing something in the field definition or there is something I don't understand about how Django converts the input into a decimal but I've not been able to find anything online about this. Any help would be greatly appreciated :)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|


