#28562: DecimalValidator raises ValidationError for decimals in scientific 
notation
-------------------------------------+-------------------------------------
     Reporter:  Maksim Iakovlev      |                    Owner:  Josh
                                     |  Schneier
         Type:  Bug                  |                   Status:  new
    Component:  Core (Other)         |                  Version:  master
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Ready for
                                     |  checkin
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Josh Harwood):

 * status:  closed => new
 * resolution:  fixed =>


Comment:

 Running version Django==2.0.1

 With Example form

 {{{
 class UpdateBalanceForm(forms.Form):
     id = forms.ModelChoiceField(ProductPortfolio.objects.all(),
 required=True)
     balance = forms.DecimalField(decimal_places=2, max_digits=16,
 required=True)
 }}}

 Running the following you get

 {{{
 form = UpdateBalanceForm({'id':1,
 'balance':Decimal('5.420575188741E-12')})
 form.is_valid()
 False
 form.errors
 {'id': ['Select a valid choice. That choice is not one of the available
 choices.'], 'balance': ['Ensure that there are no more than 16 digits in
 total.']}
 }}}

 This is surprising because the value has 13 digits minus the scientific
 notation

-- 
Ticket URL: <https://code.djangoproject.com/ticket/28562#comment:6>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.262e1195dbc8b474dfcc667521607970%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to