Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make compatible with Django 4.0 #158

Closed
roordaj opened this issue Jan 8, 2022 · 4 comments · Fixed by #161
Closed

Make compatible with Django 4.0 #158

roordaj opened this issue Jan 8, 2022 · 4 comments · Fixed by #161

Comments

@roordaj
Copy link

roordaj commented Jan 8, 2022

Hi,

I just started using DTU in a Django 4.0 project. I noticed that the following changes had to be made to be compatible. I made the changes in my virtualenv and it's working now, but it would be great if it is changed in the source code so that i dont have to ship my own copy of DTU with the source code. I'm relatively new to Django so please advice if there is a better way to solve these issues.

Following changes have to be made:
tenants > models.py

  • replace ugettext_lazy with gettext_lazy
  • remove providing_args from the Signals

permissions > models.py

  • replace ugettext_lazy with gettext_lazy
@Dresdn
Copy link
Collaborator

Dresdn commented Jan 8, 2022

I thought there was a Django 4.0 issue already, so thanks for opening. More than happy to take a look at a PR, otherwise, I'll add it and get a release out, which is way overdue.

@roordaj
Copy link
Author

roordaj commented Feb 4, 2022

Thanks so much @Dresdn! When are you planning to create a new release and push that to PyPi?

@Dresdn
Copy link
Collaborator

Dresdn commented Feb 8, 2022

Hi @roordaj - I'll get something out this week! I've been dragging my feet a bit on it.

@8byr0
Copy link

8byr0 commented Feb 9, 2022

Looking forward to it too!

If anyone reaches that issue as I did and if the release is not out yet, here's a quick and dirty solution to make your project work while awaiting official solution:

# in settings.py
from django.utils.translation import gettext_lazy
from django.dispatch import Signal
django.utils.translation.ugettext_lazy = gettext_lazy
django.utils.encoding.force_text = force_str


class CustomSignal(Signal):
    def __init__(self, providing_args=[], use_caching=False):
        super().__init__(use_caching)


django.dispatch.Signal = CustomSignal

This will prevent crashes due to the use of removed methods in django 4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants