Fixed #27199 -- Made AdminIntegerFieldWidget use NumberInput.

This commit is contained in:
Rinat Khabibiev 2016-09-08 18:58:42 +03:00 committed by Tim Graham
parent dab653cadc
commit ca9c69a968
3 changed files with 6 additions and 3 deletions

View File

@ -385,7 +385,7 @@ class AdminURLFieldWidget(forms.URLInput):
return html
class AdminIntegerFieldWidget(forms.TextInput):
class AdminIntegerFieldWidget(forms.NumberInput):
class_name = 'vIntegerField'
def __init__(self, attrs=None):

View File

@ -488,6 +488,9 @@ Miscellaneous
``migrate`` command. Use the new :djadmin:`remove_stale_contenttypes` command
instead.
* The admin's widget for ``IntegerField`` uses ``type="number"`` rather than
``type="text"``.
.. _deprecated-features-1.11:
Features deprecated in 1.11

View File

@ -366,13 +366,13 @@ class TestInline(TestDataMixin, TestCase):
self.assertContains(
response,
'<input class="vIntegerField" id="id_editablepkbook_set-0-manual_pk" '
'name="editablepkbook_set-0-manual_pk" type="text" />',
'name="editablepkbook_set-0-manual_pk" type="number" />',
html=True, count=1
)
self.assertContains(
response,
'<input class="vIntegerField" id="id_editablepkbook_set-2-0-manual_pk" '
'name="editablepkbook_set-2-0-manual_pk" type="text" />',
'name="editablepkbook_set-2-0-manual_pk" type="number" />',
html=True, count=1
)