db.models.DecimalField.decimal_places

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.

doc_Django
2016-10-09 18:35:17
Comments
Leave a Comment

Please login to continue.