Django forms DecimalField decimal_places argument is required?

Django’s documentation states that DecimalField has two required arguments: max_digits and decimal_places ( Model field reference | Django documentation | Django ) but both arguments has default value set to None (as if they were optional). I’m using DecimalField without setting decimal_places (to allow any number of decimals) and I don’t get any error.

My question is: Are max_digits and decimal_places really required or there’s an error in documentation?

Thanks in advance.

Django’s DecimalField requires both max_digits and decimal_places.

They look optional because of default None, but that’s only a placeholder, not a true default —

omitting them may work on SQLite, but fails or rounds data on production databases.

1 Like

I was looking at models.DecimalField and not forms.DecimalField documentation (Form fields | Django documentation | Django). The latter allows optional max_digits and decimal_places. Sorry, my mistake.