#34473: StepValueValidator does not take into account min_value
-----------------------------------------+------------------------
               Reporter:  James Meakin   |          Owner:  nobody
                   Type:  Uncategorized  |         Status:  new
              Component:  Uncategorized  |        Version:  4.1
               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              |
-----------------------------------------+------------------------
 If you define a number input with `<input type="number" min=1 step=2>`,
 client side this will only allow positive odd numbers.

 We could generate the same input in a Django form with
 `IntegerField(min_value=1, step_size=2)` and `Field.localize` is `False`,
 which would then use `MinValueValidator` and `StepValueValidator`.

 We then get into a problem as `StepValueValidator` always uses `0` as the
 base, so `step_size=2` only even numbers are allowed. This then conflicts
 with the client side validation, and the user cannot submit any value for
 the input.

 I'm unsure if this is a bug or whether this is just a configuration
 problem, apologies if so, but the behaviour does seem to me to conflict
 with how min and step is handled by browsers.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34473>
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701875b9ecc38-d0b02231-8e0b-41b7-8acc-e57f7343c8ec-000000%40eu-central-1.amazonses.com.

Reply via email to