`ugettext_lazy` is deprecated and will be removed in Django 4.0
tbrlpld opened this issue · comments
Tibor Leupold commented
Running a project depending on this library with Django >= 3.0 with deprecation warnings activated (e.g. python -Wa manage.py test
) shows the following warnings for wagtail-django-recaptcha
:
[...]/lib/python3.8/site-packages/captcha/fields.py:26: RemovedInDjango40Warning: django.utils.translation.ugettext_lazy() is deprecated in favor of django.utils.translation.gettext_lazy().
"captcha_invalid": _("Error verifying reCAPTCHA, please try again."),
[...]/lib/python3.8/site-packages/captcha/fields.py:27: RemovedInDjango40Warning: django.utils.translation.ugettext_lazy() is deprecated in favor of django.utils.translation.gettext_lazy().
"captcha_error": _("Error verifying reCAPTCHA, please try again."),
The solution is to simply remove the leading u
in the method name, since that method is simply a alias for gettext_lazy
: https://docs.djangoproject.com/en/3.2/releases/3.0/#id3
Tibor Leupold commented
Never mind me. This is not the correct package. This package does not use any "gettext" according to a quick search in the repo.