From ee09bf2a8e57d1c56f0902fd90a304d35a447dcb Mon Sep 17 00:00:00 2001 From: Virginia Dooley Date: Tue, 7 May 2024 08:58:15 +0100 Subject: [PATCH] Don't accept result values with . --- ynr/apps/uk_results/tests/test_smoke_test_views.py | 2 +- ynr/apps/utils/widgets.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ynr/apps/uk_results/tests/test_smoke_test_views.py b/ynr/apps/uk_results/tests/test_smoke_test_views.py index 5ae5ac0d4..d10b27cbe 100644 --- a/ynr/apps/uk_results/tests/test_smoke_test_views.py +++ b/ynr/apps/uk_results/tests/test_smoke_test_views.py @@ -49,7 +49,7 @@ def test_form_view_creates_result(self): resp = self.app.get(url, user=self.user_who_can_record_results) self.assertEqual(resp.status_code, 200) self.assertContains(resp, 'inputmode="numeric"') - self.assertContains(resp, r'pattern="[0-9\s\.,]*"') + self.assertContains(resp, r'pattern="[0-9\s\,]*"') form = resp.forms[1] form["memberships_13"] = 1000 form["memberships_14"] = 2000 diff --git a/ynr/apps/utils/widgets.py b/ynr/apps/utils/widgets.py index 65f885661..d151bb727 100644 --- a/ynr/apps/utils/widgets.py +++ b/ynr/apps/utils/widgets.py @@ -43,7 +43,7 @@ def build_attrs(self, base_attrs, extra_attrs=None): attrs.update( { "inputmode": "numeric", - "pattern": r"[0-9\s\.,]*", + "pattern": r"[0-9\s,]*", "oninvalid": "this.setCustomValidity('Enter a number')", } )