DecimalField.decimal_places
The number of decimal places to store with the number.
For example, to store numbers up to 999
with a resolution of 2 decimal places, you’d use:
models.DecimalField(..., max_digits=5, decimal_places=2)
And to store numbers up to approximately one billion with a resolution of 10 decimal places:
models.DecimalField(..., max_digits=19, decimal_places=10)
The default form widget for this field is a NumberInput
when localize
is False
or TextInput
otherwise.
Note
For more information about the differences between the FloatField
and DecimalField
classes, please see FloatField vs. DecimalField.
Please login to continue.