#27907: DecimalFields don't work with initial
--------------------------------------+------------------------
               Reporter:  fvox13      |          Owner:  nobody
                   Type:  Bug         |         Status:  new
              Component:  Forms       |        Version:  1.10
               Severity:  Normal      |       Keywords:
           Triage Stage:  Unreviewed  |      Has patch:  0
    Needs documentation:  0           |    Needs tests:  0
Patch needs improvement:  0           |  Easy pickings:  0
                  UI/UX:  0           |
--------------------------------------+------------------------
 Consider a simple form with a DecimalField:


 {{{
 class PatronLevelForm(forms.Form):
         name = forms.CharField()
         lower_threshold = forms.DecimalField(max_digits=20,
 decimal_places=2)
 }}}


 In a view, set up some initial data:

 {{{
 form = PatronLevelForm(initial={'name': 'Valued Donor', 'lower_threshold':
 Decimal(0.01),},)
 }}}


 The Decimal gets cast to float and request.POST ends up looking like this:


 {{{
 <QueryDict: {u'name': [u'Valued Donor'], u'lower_threshold':
 [u'0.01000000000000000020816681711721685132943093776702880859375']}>
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/27907>
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/049.c821378e7ca45140c28f329917b0e304%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to