summaryrefslogtreecommitdiff
path: root/django/forms/widgets.py
diff options
context:
space:
mode:
authorHasan Ramezani <hasan.r67@gmail.com>2019-10-26 16:42:32 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2019-10-29 09:22:26 +0100
commite3d0b4d5501c6d0bc39f035e4345e5bdfde12e41 (patch)
treea8ddbafdf4a38a87df6f65fc4d02dba08c725096 /django/forms/widgets.py
parent39a34d4bf94bc8325119bc23b64f3a041a85dd2d (diff)
Fixed #30899 -- Lazily compiled import time regular expressions.
Diffstat (limited to 'django/forms/widgets.py')
-rw-r--r--django/forms/widgets.py4
1 files changed, 2 insertions, 2 deletions
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 {}