From f1f434dce1174199cc6cab1c33900d12257aad33 Mon Sep 17 00:00:00 2001 From: kadir Date: Wed, 13 Mar 2024 19:26:50 +0300 Subject: [PATCH] Updated project to Django 5.0.2 and made necessary changes to accommodate removed methods in this version. - Added the orce_str method to the est_auth\serializers.py file. - Added the gettext_lazy method to the iews.py file. - Replaced url functions with path functions in the urlpatterns list. With these changes, I've updated the project to be compatible with the latest Django version and adjusted for removed methods, thereby enhancing project stability. --- rest_auth/registration/serializers.py | 2 +- rest_auth/registration/views.py | 2 +- rest_auth/serializers.py | 4 ++-- rest_auth/tests/mixins.py | 2 +- rest_auth/tests/test_api.py | 2 +- rest_auth/urls.py | 16 ++++++++-------- rest_auth/views.py | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/rest_auth/registration/serializers.py b/rest_auth/registration/serializers.py index 4f99c182..6baa1a40 100644 --- a/rest_auth/registration/serializers.py +++ b/rest_auth/registration/serializers.py @@ -1,5 +1,5 @@ from django.http import HttpRequest -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from django.contrib.auth import get_user_model try: diff --git a/rest_auth/registration/views.py b/rest_auth/registration/views.py index 0e0ab0d0..bab1c1c4 100644 --- a/rest_auth/registration/views.py +++ b/rest_auth/registration/views.py @@ -1,6 +1,6 @@ from django.conf import settings 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.decorators.debug import sensitive_post_parameters from rest_framework.views import APIView diff --git a/rest_auth/serializers.py b/rest_auth/serializers.py index b6452317..e5408301 100644 --- a/rest_auth/serializers.py +++ b/rest_auth/serializers.py @@ -3,8 +3,8 @@ from django.contrib.auth.forms import PasswordResetForm, SetPasswordForm from django.contrib.auth.tokens import default_token_generator from django.utils.http import urlsafe_base64_decode as uid_decoder -from django.utils.translation import ugettext_lazy as _ -from django.utils.encoding import force_text +from django.utils.translation import gettext_lazy as _ +from django.utils.encoding import force_str from rest_framework import serializers, exceptions from rest_framework.exceptions import ValidationError diff --git a/rest_auth/tests/mixins.py b/rest_auth/tests/mixins.py index 30b3d586..ac79cca2 100644 --- a/rest_auth/tests/mixins.py +++ b/rest_auth/tests/mixins.py @@ -2,7 +2,7 @@ from django.conf import settings from django.test.client import Client, MULTIPART_CONTENT -from django.utils.encoding import force_text +from django.utils.encoding import force_str from rest_framework import status from rest_framework import permissions diff --git a/rest_auth/tests/test_api.py b/rest_auth/tests/test_api.py index 9c5fd9ea..a21c1ba1 100644 --- a/rest_auth/tests/test_api.py +++ b/rest_auth/tests/test_api.py @@ -2,7 +2,7 @@ from django.contrib.auth import get_user_model from django.core import mail from django.conf import settings -from django.utils.encoding import force_text +from django.utils.encoding import force_str from allauth.account import app_settings as account_app_settings from rest_framework import status diff --git a/rest_auth/urls.py b/rest_auth/urls.py index 7a35e9b5..ffb6f94c 100644 --- a/rest_auth/urls.py +++ b/rest_auth/urls.py @@ -1,4 +1,4 @@ -from django.conf.urls import url +from django.urls import path from rest_auth.views import ( LoginView, LogoutView, UserDetailsView, PasswordChangeView, @@ -7,14 +7,14 @@ urlpatterns = [ # URLs that do not require a session or valid token - url(r'^password/reset/$', PasswordResetView.as_view(), + path('password/reset/', PasswordResetView.as_view(), name='rest_password_reset'), - url(r'^password/reset/confirm/$', PasswordResetConfirmView.as_view(), + path('password/reset/confirm/', PasswordResetConfirmView.as_view(), name='rest_password_reset_confirm'), - url(r'^login/$', LoginView.as_view(), name='rest_login'), + path('login/', LoginView.as_view(), name='rest_login'), # URLs that require a user to be logged in with a valid session / token. - url(r'^logout/$', LogoutView.as_view(), name='rest_logout'), - url(r'^user/$', UserDetailsView.as_view(), name='rest_user_details'), - url(r'^password/change/$', PasswordChangeView.as_view(), + path('logout/', LogoutView.as_view(), name='rest_logout'), + path('user/', UserDetailsView.as_view(), name='rest_user_details'), + path('password/change/', PasswordChangeView.as_view(), name='rest_password_change'), -] +] \ No newline at end of file diff --git a/rest_auth/views.py b/rest_auth/views.py index 0a0a982e..d436fdde 100644 --- a/rest_auth/views.py +++ b/rest_auth/views.py @@ -6,7 +6,7 @@ from django.contrib.auth import get_user_model from django.core.exceptions import ObjectDoesNotExist 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.decorators.debug import sensitive_post_parameters from rest_framework import status