From 290e82b9229db3f1833a150f2e32f18405205ff3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Freitag?= Date: Sat, 27 Aug 2022 16:10:36 +0200 Subject: [PATCH] Set PhoneNumberInternationalFallbackWidget input_type to tel --- phonenumber_field/widgets.py | 2 ++ tests/test_widgets.py | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/phonenumber_field/widgets.py b/phonenumber_field/widgets.py index 795ee891..dc1729ea 100644 --- a/phonenumber_field/widgets.py +++ b/phonenumber_field/widgets.py @@ -119,6 +119,8 @@ class PhoneNumberInternationalFallbackWidget(TextInput): an international number will fall back to international format """ + input_type = "tel" + def __init__(self, region=None, attrs=None): if region is None: region = getattr(settings, "PHONENUMBER_DEFAULT_REGION", None) diff --git a/tests/test_widgets.py b/tests/test_widgets.py index ea7608a4..81af9b02 100644 --- a/tests/test_widgets.py +++ b/tests/test_widgets.py @@ -248,15 +248,15 @@ def test_fallback_widget_switches_between_national_and_international(self): de_widget = PhoneNumberInternationalFallbackWidget(region="DE") self.assertHTMLEqual( gb_widget.render("number", number), - '', + '', ) self.assertHTMLEqual( de_widget.render("number", number), - '', + '', ) # If there's been a validation error, the value should be included verbatim self.assertHTMLEqual( gb_widget.render("number", "error"), - '', + '', )