[Django] #28303: IntegerField & NumberInput widget localize max_value when rendering form field

35 views
Skip to first unread message

Django

unread,
Jun 13, 2017, 11:54:20 AM6/13/17
to django-...@googlegroups.com
#28303: IntegerField & NumberInput widget localize max_value when rendering form
field
----------------------------------------+------------------------
Reporter: Richard Owen | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 1.11
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 |
----------------------------------------+------------------------
This issue is a change / regression in Django 1.11. It works correctly
with Django 1.10. Tested on Django 1.11.2 and Python 2.7.13.

== Reproduction Steps

1. Enable the following settings:

{{{
USE_L10N = True
USE_THOUSAND_SEPARATOR = True
}}}

2. Create a form with an IntegerField with a large max_value set:

{{{
class TestForm(forms.Form):
integer_field = forms.IntegerField(max_value=999999)
}}}

== Expected Result
Form is rendered as
{{{
<input type="number" name="integer_field" max="999999" required
id="id_integer_field" />
}}}

== Actual Result
Form is rendered as
{{{
<input type="number" name="integer_field" max="999,999" required
id="id_integer_field" />
}}}

Note the comma separator in the max attribute on the input.

Internet Explorer 11 treats this field as having a max attribute of 999.
So entering a value of 1000 in the field prevents the user from submitting
the form.

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

Django

unread,
Jun 13, 2017, 12:05:22 PM6/13/17
to django-...@googlegroups.com
#28303: IntegerField & NumberInput widget localize max_value when rendering form
field
---------------------------------+------------------------------------

Reporter: Richard Owen | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 1.11
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by Tim Graham):

* severity: Normal => Release blocker
* stage: Unreviewed => Accepted


Comment:

581879a510e58841e5780a5d1fdb4995733d2036 fixed a similar issue and might
be a useful template for developing a patch.

--
Ticket URL: <https://code.djangoproject.com/ticket/28303#comment:1>

Django

unread,
Jun 14, 2017, 7:43:47 AM6/14/17
to django-...@googlegroups.com
#28303: IntegerField & NumberInput widget localize max_value when rendering form
field
---------------------------------+------------------------------------

Reporter: Richard Owen | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 1.11
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by Tim Graham):

* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/8639 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/28303#comment:2>

Django

unread,
Jun 17, 2017, 8:12:24 AM6/17/17
to django-...@googlegroups.com
#28303: IntegerField & NumberInput widget localize max_value when rendering form
field
---------------------------------+------------------------------------

Reporter: Richard Owen | Owner: nobody
Type: Bug | Status: closed
Component: Forms | Version: 1.11
Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by GitHub <noreply@…>):

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


Comment:

In [changeset:"3b050fd0d0b8dbf499bdb44ce12fa926298c0bd0" 3b050fd]:
{{{
#!CommitTicketReference repository=""
revision="3b050fd0d0b8dbf499bdb44ce12fa926298c0bd0"
Fixed #28303 -- Prevented localization of attribute values in the DTL
attrs.html widget template.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28303#comment:3>

Django

unread,
Jun 17, 2017, 5:21:12 PM6/17/17
to django-...@googlegroups.com
#28303: IntegerField & NumberInput widget localize max_value when rendering form
field
---------------------------------+------------------------------------

Reporter: Richard Owen | Owner: nobody
Type: Bug | Status: closed
Component: Forms | Version: 1.11

Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"f0ec88fb63f39db38ab027477167f9d7a7ea151c" f0ec88fb]:
{{{
#!CommitTicketReference repository=""
revision="f0ec88fb63f39db38ab027477167f9d7a7ea151c"
[1.11.x] Fixed #28303 -- Prevented localization of attribute values in the
DTL attrs.html widget template.

Backport of 3b050fd0d0b8dbf499bdb44ce12fa926298c0bd0 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28303#comment:4>

Reply all
Reply to author
Forward
0 new messages