I'm updating a very old Django project and trying to use RegistrationSupplementBase
but when importing, I got the error below:
File "/home/projectmachine/Desktop/project_rebuild/projectname/models.py", line 11, in <module>
from registration.supplements.base import RegistrationSupplementBase
File "/home/projectmachine/.local/share/virtualenvs/projectname-QrYA9Qp-/lib/python3.6/site-packages/registration/supplements/base.py", line 9, in <module>
from django.utils.text import ugettext_lazy as _
ImportError: cannot import name 'ugettext_lazy'
I can't figure out what's wrong. It seems like there is an issue with the dependancies installed. I'm using Django 2.2 with django-inspectional-registration 0.6.2
Here is how I am importing the class:
from registration.supplements.base import RegistrationSupplementBase
I can't figure out what's wrong. It seems like there is an issue with the dependancies installed. I'm using Django 2.2 with
django-inspectional-registration
0.6.2
The function has been moved to the django.utils.translation
module, so you can import this with:
from django.utils.translation import ugettext_lazy as _
Based on the Django Deprecation Timeline [Django-doc], ugettext_lazy
will be removed in django-4.0. You can use gettext_lazy
instead:
from django.utils.translation import gettext_lazy as _
Based on the GitHub repository of django-inspectional-registration
however, the project is not active anymore: the latest commit was in november 2016. You can try to update the project, but perhaps it is better to look for an alternative package that works in a similar way.