Tuesday, November 5, 2013

Re: DecimalField

Thanks Tom.  This did the trick.  Much appreciated.

On Sunday, August 25, 2013 5:47:00 AM UTC-4, Derrick Jackson wrote:
Hi All,

My Model has a DecimalField:      

amount = models.DecimalField(max_digits=19, decimal_places=2, verbose_name='Amount')

My ModelForm has the following:  

self.fields['amount'] = forms.DecimalField(error_messages={
            'required': 'Amount is required.',
            'invalid': 'Numbers only.',
            'max_decimal_places': 'Only 2 decimal places.'})

However the max_decimal_places validation check does not seem to be working.  Is there a certain way I need to use this that will properly allow the error to be thrown?

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f90b9765-0248-4600-a19c-241b8745f188%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate