Thursday, January 17, 2013

quantize result has too many digits for current context

Hello,

I have this model:

class ItensPedido(models.Model):
    idvenda_pedido_itens = models.IntegerField(u'Código', primary_key=True, null=False)
    idvenda_pedido = models.ForeignKey('Pedido', db_column='idvenda_pedido', null=False, blank=False)
    idproduto = models.ForeignKey('Produto', db_column='idproduto', verbose_name=u'Produto', null=False, blank=False)
    qnt = models.IntegerField(verbose_name=u'Quantidade', null=False, blank=False, default=1)
    preco_unit = models.DecimalField(u'Preço Unit.', max_digits=12, decimal_places=4, null=False, default=0)
    valor_total = models.DecimalField(u'Vlr. Total', max_digits=12, decimal_places=4, null=False, default=0)

    class Meta:
        managed = False
        db_table = 'venda_pedido_itens'


and in my template I try to use: {{ form.idpedido }}

but when I`m use this, django show me this error:

quantize result has too many digits for current context

I have lookup the internet and I see some error like this, but always about Decimals fields.. but in my case this error appears in Foreign Key field.

My question is: Why this error appears? How can I fix this?

Thanks for all,

Regards,
T.·.F.·.A.·.     S+F
Fellipe Henrique P. Soares

"Quemadmodum gladius neminem occidit, occidentis telum est." (Epistulae morales ad Lucilium, Lucius Annaeus Seneca)

"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." 
Albert Einstein (March 14th 1879 – April 18th 1955)

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate