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.
This commit is contained in:
kadir 2024-03-13 19:26:50 +03:00
parent cdd04aa9be
commit f1f434dce1
7 changed files with 15 additions and 15 deletions

View File

@ -1,5 +1,5 @@
from django.http import HttpRequest 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 from django.contrib.auth import get_user_model
try: try:

View File

@ -1,6 +1,6 @@
from django.conf import settings from django.conf import settings
from django.utils.decorators import method_decorator 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 django.views.decorators.debug import sensitive_post_parameters
from rest_framework.views import APIView from rest_framework.views import APIView

View File

@ -3,8 +3,8 @@ from django.conf import settings
from django.contrib.auth.forms import PasswordResetForm, SetPasswordForm from django.contrib.auth.forms import PasswordResetForm, SetPasswordForm
from django.contrib.auth.tokens import default_token_generator from django.contrib.auth.tokens import default_token_generator
from django.utils.http import urlsafe_base64_decode as uid_decoder from django.utils.http import urlsafe_base64_decode as uid_decoder
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from django.utils.encoding import force_text from django.utils.encoding import force_str
from rest_framework import serializers, exceptions from rest_framework import serializers, exceptions
from rest_framework.exceptions import ValidationError from rest_framework.exceptions import ValidationError

View File

@ -2,7 +2,7 @@ import json
from django.conf import settings from django.conf import settings
from django.test.client import Client, MULTIPART_CONTENT 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 status
from rest_framework import permissions from rest_framework import permissions

View File

@ -2,7 +2,7 @@ from django.test import TestCase, override_settings
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model
from django.core import mail from django.core import mail
from django.conf import settings 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 allauth.account import app_settings as account_app_settings
from rest_framework import status from rest_framework import status

View File

@ -1,4 +1,4 @@
from django.conf.urls import url from django.urls import path
from rest_auth.views import ( from rest_auth.views import (
LoginView, LogoutView, UserDetailsView, PasswordChangeView, LoginView, LogoutView, UserDetailsView, PasswordChangeView,
@ -7,14 +7,14 @@ from rest_auth.views import (
urlpatterns = [ urlpatterns = [
# URLs that do not require a session or valid token # 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'), name='rest_password_reset'),
url(r'^password/reset/confirm/$', PasswordResetConfirmView.as_view(), path('password/reset/confirm/', PasswordResetConfirmView.as_view(),
name='rest_password_reset_confirm'), 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. # URLs that require a user to be logged in with a valid session / token.
url(r'^logout/$', LogoutView.as_view(), name='rest_logout'), path('logout/', LogoutView.as_view(), name='rest_logout'),
url(r'^user/$', UserDetailsView.as_view(), name='rest_user_details'), path('user/', UserDetailsView.as_view(), name='rest_user_details'),
url(r'^password/change/$', PasswordChangeView.as_view(), path('password/change/', PasswordChangeView.as_view(),
name='rest_password_change'), name='rest_password_change'),
] ]

View File

@ -6,7 +6,7 @@ from django.conf import settings
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model
from django.core.exceptions import ObjectDoesNotExist from django.core.exceptions import ObjectDoesNotExist
from django.utils.decorators import method_decorator 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 django.views.decorators.debug import sensitive_post_parameters
from rest_framework import status from rest_framework import status