From 529c80efda19338e428066db582a115d4ce46f74 Mon Sep 17 00:00:00 2001 From: Chetan Ghadawaje Date: Wed, 3 May 2023 00:20:10 +0530 Subject: [PATCH] As per new django version update import. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit django.utils.translation.ugettext(), ugettext_lazy(), ugettext_noop(), ungettext(), and ungettext_lazy() are deprecated in favor of the functions that they’re aliases for: django.utils.translation.gettext(), gettext_lazy(), gettext_noop(), ngettext(), and ngettext_lazy(). --- floppyforms/widgets.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/floppyforms/widgets.py b/floppyforms/widgets.py index c890a6e..d7b854e 100644 --- a/floppyforms/widgets.py +++ b/floppyforms/widgets.py @@ -13,7 +13,11 @@ from django.conf import settings from django.template import loader from django.utils.html import conditional_escape -from django.utils.translation import ugettext_lazy as _ +if django.VERSION >= (3, 0): + # See https://docs.djangoproject.com/en/dev/releases/3.0/#features-deprecated-in-3-0 + from django.utils.translation import gettext_lazy as _ +else: + from django.utils.translation import ugettext_lazy as _ from django.utils import datetime_safe, formats, six from django.utils.dates import MONTHS from django.utils.encoding import force_text @@ -21,7 +25,6 @@ from .compat import MULTIVALUE_DICT_TYPES, flatten_contexts - RE_DATE = re.compile(r'(\d{4})-(\d\d?)-(\d\d?)$')