jazzband / django-user-sessions

Extend Django sessions with a foreign key back to the user, allowing enumerating all user's sessions.
https://pypi.python.org/pypi/django-user-sessions
MIT License
628 stars 128 forks source link

Application does not works with Django 4.0 #140

Closed ricco386 closed 2 years ago

ricco386 commented 2 years ago

Once application is installed to Django >4.0 project, or project Django is upgraded application throws an exception.

File "/home/.../.../.../envs3/lib64/python3.9/site-packages/user_sessions/models.py", line 3, in <module>
    from django.utils.translation import ugettext_lazy as _
ImportError: cannot import name 'ugettext_lazy' from 'django.utils.translation' (/home/rvk/Projects/kurzy-website/envs3/lib64/python3.9/site-packages/django/utils/translation/__init__.py)

Expected Behavior

Application should run the same as it would with older Django 3.*

Current Behavior

Applicaiotn with Django 4.* throws an exception.

Possible Solution

It seems to be an easy fix. Just replace: from django.utils.translation import ugettext_lazy as _ with from django.utils.translation import gettext_lazy as _

More at: https://docs.djangoproject.com/en/dev/internals/deprecation/#deprecation-removed-in-4-0

Steps to Reproduce (for bugs)

  1. Upgrade Django to 4.0

Context

I am trying to upgrade Django, but the app no longer works, and either I am not able to upgrade, or I have to disable django-user-sessions.

ricco386 commented 2 years ago

I have tested the latest master and it seems to be working fine with Django 4, this is just a problem of current latest release 1.7.1.