In case anyone else ends up here, I've found that it's very sensitive to 
how you specify the Decimal, so in my example Decimal('20.00') worked but 
Decimal('20') and Decimal(20) did not.

On Monday, April 20, 2015 at 6:44:30 PM UTC+1, eltonplima wrote:
>
> In the model below, using the Django admin, no matter what value I choose, 
> it always displays the default value. But writes the correct value in the 
>  database. Am I doing something wrong or is this a bug?
>
> TENSAO_220 = Decimal(220)
> TENSAO_110 = Decimal(110)
> TENSOES = ((TENSAO_220, '220 volts'),
>            (TENSAO_110, '110 volts'))
>
> class Equipamento(models.Model):
>     nome = models.CharField(max_length=128)
>   tensao = models.DecimalField(max_digits=8,
>                                decimal_places=3,
>                                choices=TENSOES,
>                                default=TENSAO_220)
>
> Thanks!
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/26c4211e-fabe-47d7-b930-1da31fedeb01%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to