I've got a model like:
class ModelWithDecimal(models.Model):
value = models.DecimalField(max_digits=2,decimal_places=2)
...yet when I try...
obj = ModelWithDecimal(value="1.5")
obj.save()
I get a quantize result has too many digits for current context error during the save. Shouldn't that be OK - it's less than 2 digits, and less than 2 digits after the decimal-point?
The same error happens with a model:
class ModelWithDecimal(models.Model):
value = models.DecimalField(max_digits=11,decimal_places=8)
...and attempted instance...
obj = ModelWithDecimal(value="1005.7")
obj.save()
Again, seems it should work: only 4 total digits (less than 11), and only 1 after decimal (less than 8).
What's wrong?