Hi,
I want to combine a model decimal field with a forms choice field.
The field in the model:
sum = models.DecimalField(max_digits=2, decimal_places=2)
The field in the form:
sum = forms.ChoiceField(choices=WORK_HOUR_CHOICES, label='Sum Working Hours', required=True)
The choices:
WORK_HOUR_CHOICES = (
(0, '0'),
(0.5, '0.5'),
(1, '1'),
(1.5, '1.5'),
(2, '2'),
(2.5, '2.5')
)
But always when I want to store a value with a decimal place I get this error:
quantize result has too many digits for current context
When I save a 0 or 1 it works fine.
What's wrong?