5๐
โ
I had a similar problem and what I have done to solve it is to make sure that the value I want to save fits in the field, two things:
- First, use
round(myValueFloat, 4)
. It is, to reduce the number of decimal numbers I try to save. - Use bigger fields for the values I can not reduce.
๐คManuel Gijรณn
23๐
I recently got this problem myself. The way I thought I knew about decimal fields was wrong in my case.
I thought max_digits=x gives x values for the integer part and decimal_places=y gives y values for the decimal part but I was wrong.
max_digits define the total no. of digits overall and decimal places are part of the max_digits.
for eg. if max_digits=13
and decimal_places=3
then the field will store numeric values up to a billion with 3 precise decimals.
This may help someone who got stuck as I did for the past few hours.
๐คAnjaan
- Why is django's settings object a LazyObject?
- How does one use a custom widget with a generic UpdateView without having to redefine the entire form?
Source:stackexchange.com