From ca9c69a9682141bc102ad6751f2feecc3d0d9d21 Mon Sep 17 00:00:00 2001 From: Rinat Khabibiev Date: Thu, 8 Sep 2016 18:58:42 +0300 Subject: [PATCH] Fixed #27199 -- Made AdminIntegerFieldWidget use NumberInput. --- django/contrib/admin/widgets.py | 2 +- docs/releases/1.11.txt | 3 +++ tests/admin_inlines/tests.py | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/django/contrib/admin/widgets.py b/django/contrib/admin/widgets.py index e3553de70a..d110ee46ba 100644 --- a/django/contrib/admin/widgets.py +++ b/django/contrib/admin/widgets.py @@ -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): diff --git a/docs/releases/1.11.txt b/docs/releases/1.11.txt index 221f58f291..afd24e6613 100644 --- a/docs/releases/1.11.txt +++ b/docs/releases/1.11.txt @@ -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 diff --git a/tests/admin_inlines/tests.py b/tests/admin_inlines/tests.py index 95e38e8bb7..03c9a05dbe 100644 --- a/tests/admin_inlines/tests.py +++ b/tests/admin_inlines/tests.py @@ -366,13 +366,13 @@ class TestInline(TestDataMixin, TestCase): self.assertContains( response, '', + 'name="editablepkbook_set-0-manual_pk" type="number" />', html=True, count=1 ) self.assertContains( response, '', + 'name="editablepkbook_set-2-0-manual_pk" type="number" />', html=True, count=1 )