From aea2bd6c725eb06da51fd99abcac232cbf857f06 Mon Sep 17 00:00:00 2001 From: saschahofmann Date: Wed, 9 Feb 2022 09:02:30 +0100 Subject: [PATCH 1/4] Update import for django 4.0 --- invitations/adapters.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/invitations/adapters.py b/invitations/adapters.py index f30b7f3..c02984a 100644 --- a/invitations/adapters.py +++ b/invitations/adapters.py @@ -9,9 +9,12 @@ from .utils import import_attribute try: - from django.utils.encoding import force_text + from django.utils.encoding import force_str as force_text except ImportError: - from django.utils.encoding import force_unicode as force_text + try: + from django.utils.encoding import force_text + except ImportError: + from django.utils.encoding import force_unicode as force_text # Code credits here to django-allauth From 618fc4ef87b9912777255590f289df3ae24ec9f3 Mon Sep 17 00:00:00 2001 From: saschahofmann Date: Wed, 9 Feb 2022 10:49:16 +0100 Subject: [PATCH 2/4] replace ugettext_lazy with gettext_lazy --- invitations/base_invitation.py | 2 +- invitations/forms.py | 2 +- invitations/models.py | 2 +- invitations/views.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/invitations/base_invitation.py b/invitations/base_invitation.py index cc45b70..15f0589 100644 --- a/invitations/base_invitation.py +++ b/invitations/base_invitation.py @@ -1,6 +1,6 @@ from django.conf import settings from django.db import models -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from .managers import BaseInvitationManager diff --git a/invitations/forms.py b/invitations/forms.py index d20c8ec..efa61c9 100644 --- a/invitations/forms.py +++ b/invitations/forms.py @@ -1,6 +1,6 @@ from django import forms from django.contrib.auth import get_user_model -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from .adapters import get_invitations_adapter from .exceptions import AlreadyAccepted, AlreadyInvited, UserRegisteredEmail diff --git a/invitations/models.py b/invitations/models.py index 3008ec6..c163310 100644 --- a/invitations/models.py +++ b/invitations/models.py @@ -9,7 +9,7 @@ from django.db import models from django.utils import timezone from django.utils.crypto import get_random_string -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from . import signals from .adapters import get_invitations_adapter diff --git a/invitations/views.py b/invitations/views.py index 58c5713..ab0b505 100644 --- a/invitations/views.py +++ b/invitations/views.py @@ -7,7 +7,7 @@ from django.http import Http404, HttpResponse from django.shortcuts import redirect from django.utils.decorators import method_decorator -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from django.views.generic import FormView, View from django.views.generic.detail import SingleObjectMixin From 83e900008afa3c060bed2c5bbf41023cc4268320 Mon Sep 17 00:00:00 2001 From: saschahofmann Date: Thu, 10 Feb 2022 15:18:35 +0100 Subject: [PATCH 3/4] update signal --- invitations/signals.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/invitations/signals.py b/invitations/signals.py index 8bf7038..086d5c5 100644 --- a/invitations/signals.py +++ b/invitations/signals.py @@ -1,7 +1,7 @@ from django.dispatch import Signal -invite_url_sent = Signal(providing_args=['invite_url_sent', 'inviter']) -invite_accepted = Signal(providing_args=['email']) +invite_url_sent = Signal() +invite_accepted = Signal() """ @receiver(invite_url_sent, sender=Invitation) From 141b87895901bea3700fa6dd46b657800764e83f Mon Sep 17 00:00:00 2001 From: saschahofmann Date: Thu, 10 Feb 2022 16:26:26 +0100 Subject: [PATCH 4/4] remove re_path --- invitations/urls.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/invitations/urls.py b/invitations/urls.py index fb1c17a..75ffa56 100644 --- a/invitations/urls.py +++ b/invitations/urls.py @@ -1,15 +1,15 @@ -from django.conf.urls import url +from django.urls import re_path from . import views app_name = 'invitations' urlpatterns = [ - url(r'^send-invite/$', views.SendInvite.as_view(), + re_path(r'^send-invite/$', views.SendInvite.as_view(), name='send-invite'), - url(r'^send-json-invite/$', views.SendJSONInvite.as_view(), + re_path(r'^send-json-invite/$', views.SendJSONInvite.as_view(), name='send-json-invite'), - url(r'^accept-invite/(?P\w+)/?$', views.AcceptInvite.as_view(), + re_path(r'^accept-invite/(?P\w+)/?$', views.AcceptInvite.as_view(), name='accept-invite'), ]