What's the default value for a DecimalField in Django?

I'm adding a new DecimalField to my model, what value will it have by default in the database (if I don't specify the default explicitly on the field e.g. default=1.23)?

amount = models.DecimalField(max_digits=15, decimal_places=3)

I'm expecting it will be either NULL or 0.0 (or None or Decimal(0.000) in python), but which?

Couldn't find this mentioned in the docs: https://docs.djangoproject.com/en/2.2/ref/models/fields/#decimalfield

I'm using Django 2.2, but expect this is consistent across versions.


Solution 1:

Django does not set any default values. You must specify the default value yourself.

amount = models.DecimalField(max_digits=15, decimal_places=3, default=0.0)

Solution 2:

Based upon your definition. The default value would be 0.000

If you had keyword argument null=True then you may expect NULL where a value has not been entered in.