diff options
Diffstat (limited to 'django/forms')
| -rw-r--r-- | django/forms/fields.py | 3 | ||||
| -rw-r--r-- | django/forms/widgets.py | 4 |
2 files changed, 4 insertions, 3 deletions
diff --git a/django/forms/fields.py b/django/forms/fields.py index 36ec634929..285f8cfc76 100644 --- a/django/forms/fields.py +++ b/django/forms/fields.py @@ -28,6 +28,7 @@ from django.utils import formats from django.utils.dateparse import parse_duration from django.utils.duration import duration_string from django.utils.ipv6 import clean_ipv6_address +from django.utils.regex_helper import _lazy_re_compile from django.utils.translation import gettext_lazy as _, ngettext_lazy __all__ = ( @@ -243,7 +244,7 @@ class IntegerField(Field): default_error_messages = { 'invalid': _('Enter a whole number.'), } - re_decimal = re.compile(r'\.0*\s*$') + re_decimal = _lazy_re_compile(r'\.0*\s*$') def __init__(self, *, max_value=None, min_value=None, **kwargs): self.max_value, self.min_value = max_value, min_value diff --git a/django/forms/widgets.py b/django/forms/widgets.py index f9627f2918..59b7880cd4 100644 --- a/django/forms/widgets.py +++ b/django/forms/widgets.py @@ -4,7 +4,6 @@ HTML Widget classes import copy import datetime -import re import warnings from collections import defaultdict from itertools import chain @@ -17,6 +16,7 @@ from django.utils.datastructures import OrderedSet from django.utils.dates import MONTHS from django.utils.formats import get_format from django.utils.html import format_html, html_safe +from django.utils.regex_helper import _lazy_re_compile from django.utils.safestring import mark_safe from django.utils.topological_sort import ( CyclicDependencyError, stable_topological_sort, @@ -935,7 +935,7 @@ class SelectDateWidget(Widget): template_name = 'django/forms/widgets/select_date.html' input_type = 'select' select_widget = Select - date_re = re.compile(r'(\d{4}|0)-(\d\d?)-(\d\d?)$') + date_re = _lazy_re_compile(r'(\d{4}|0)-(\d\d?)-(\d\d?)$') def __init__(self, attrs=None, years=None, months=None, empty_label=None): self.attrs = attrs or {} |
