#20765: HTML5 number input type not working for DecimalField with big
decimal_places
----------------------------------+--------------------------------------
     Reporter:  aleksey.kladov@…  |                    Owner:  charettes
         Type:  Bug               |                   Status:  assigned
    Component:  Forms             |                  Version:  1.6-beta-1
     Severity:  Normal            |               Resolution:
     Keywords:                    |             Triage Stage:  Accepted
    Has patch:  0                 |      Needs documentation:  0
  Needs tests:  0                 |  Patch needs improvement:  0
Easy pickings:  0                 |                    UI/UX:  0
----------------------------------+--------------------------------------

Comment (by matklad):

 I would be completely happy if I could override `step`. But it's because I
 '''know''' that I have to override it. Let me try to convince you for the
 last time that guessing step is not a good idea. There will be three
 points.

 1. Suppose I know nothing about this issue and just wrote in one of my
 forms `number = fields.DecimalField(max_digits=50, decimal_places=25)`. I
 use firefox and the form is working OK in it. Moreover, tests are working
 too. However, very soon I get a bug report that it's impossible to use
 non-integer numbers in Chrome! So I have to look into the source of the
 page, notice suspicious `step="0.0000000000000000000000000001"`, and find
 out that it is the reason of strange behaviour. Next, I have to look
 inside django's source, to find out, from where this `step` emerges. And
 only then I realize that I need to override it.

 2. Current default can produce invalid html.

     The step attribute, if specified, must either have a value that is a
 '''valid floating-point number that parses to a number that is greater
 than zero''', or must have a value that is an ASCII case-insensitive match
 for the string "any".

 3. If I close my eyes, forget about everything in the universe and ask
 myself, "what is the most reasonable default for `step`?" I hear a voice
 whispering "`any`".


 Also, this issue can show more often than it seems. 10^-18^ is quit a
 little number, and it looks like most users won't use such a high
 precision. However, it is the '''Decimal'''Field. And if someone is using
 a Decimal instead of Float, it means that he cares about high precision.
 So it's rather likely that he uses many decimal places. Also, python's
 default prec for decimals is 28 places!

-- 
Ticket URL: <https://code.djangoproject.com/ticket/20765#comment:9>
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/082.8962dc583331d6ddc1bd59b70798ae8f%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to