django-improved-user icon indicating copy to clipboard operation
django-improved-user copied to clipboard

RemovedInDjango40Warning: django.utils.translation.ugettext_lazy() is deprecated...

Open programmylife opened this issue 5 years ago • 6 comments

Specifications

  • Platform/System: Windows 10 (using Windows Subsystem for Linux)
  • Python Version: 3.8.5
  • Django Version: 3.1.4
  • Improved User Version: 1.0.1

Expected Behavior

A Django project with improved user should run without warnings.

Actual Behavior

When I upgrade my project to Django 3,1.4, I receive warnings about being deprecated from the improved user package.

Context

This issue is not currently causing any problems with my codebase. However, when Django 4.x releases in about a year, it will prevent me from upgrading to Django 4.x.

Steps to Reproduce the Problem

  1. Create a Django project with version 3.1.x
  2. Install django improved user 1.0.1
  3. run `python -Wa manage.py runserver' to run with warnings
  4. See multiple warnings like: /filelocation/env/lib/python3.8/site-packages/improved_user/model_mixins.py:115: RemovedInDjango40Warning: django.utils.translation.ugettext_lazy() is deprecated in favor of django.utils.translation.gettext_lazy(). verbose_name_plural = _('users')

Thank you for providing this package, and let me know if there is anything I can clarify.

programmylife avatar Dec 21 '20 18:12 programmylife

Hi @programmylife : thank you for opening up this issue.

Thank you also for your patience. I've had a difficult 2020/2021, and wasn't able to work on any OSS.

I've just merged PR #117 which resolves the warnings you are seeing.

I will be leaving this issue open until I am able to release a new version of the library. I am planning to do so next weekend.

If you need access to the latest changes before then, please point the dependency directly at commit d945044 in this git repo.

jambonrose avatar Nov 07 '21 01:11 jambonrose

For what it's worth, i've tested the alpha release with Django 4.0 and it worked fine on my end.

browniebroke avatar Dec 23 '21 09:12 browniebroke

Working fine after replacing - from django.utils.translation import ugettext_lazy as _ to from django.utils.translation import gettext_lazy as _

for Django 4. (Django 4.0.2)

Working fine on my end too.

INNOMIGHT avatar Feb 28 '22 09:02 INNOMIGHT

I am able to get this working locally, so thank you @jambonrose for providing that commit, but I'm having an issue getting it to install that commit directly from requirements.txt

I tried changing the install of this library in requirements.txt to: django-improved-user -e git+https://github.com/jambonsw/django-improved-user.git@d94504452c8fc64cf5af57d7b9dab9fb45fc4e9d#egg={django-improved-user} (I also tried without the #egg at the end), but this still grabs 1.0,1 even when I purge my pip cache with pip cache purge. Output:

Collecting django-improved-user
  Downloading django_improved_user-1.0.1-py3-none-any.whl (12 kB)

I can get the commit working if I uninstall and then use pip install django-improved-user git+https://github.com/jambonsw/django-improved-user.git@d94504452c8fc64cf5af57d7b9dab9fb45fc4e9d. This works fine locally, but if possible, I'd like a way to install it correctly from requirements.txt so I don't need to adjust my deployment scripts if that's not necessary.

theastroventure avatar Sep 20 '22 19:09 theastroventure

you need project @ url not -e: https://pip.pypa.io/en/stable/reference/requirements-file-format/

on the command line, you have to escape the space: your line pip install d-i-u git+https://etc passes two separate things to the command, processed separately, so you need pip install "thing @ url"

merwok avatar Sep 20 '22 19:09 merwok

@merwok that's exactly what I was missing. Thank you very much.

theastroventure avatar Sep 21 '22 12:09 theastroventure