Removed depricated django imports - support for django 5

This commit is contained in:
Michał Czuba 2025-01-22 07:12:40 +01:00
parent cdd04aa9be
commit d6f2c2c79d
8 changed files with 14 additions and 13 deletions

1
.gitignore vendored
View File

@ -24,6 +24,7 @@ wheels/
.installed.cfg
*.egg
MANIFEST
.idea/
# PyInstaller
# Usually these files are written by a python script from a template

View File

@ -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:

View File

@ -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

View File

@ -3,8 +3,8 @@ from django.conf import settings
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
@ -205,7 +205,7 @@ class PasswordResetConfirmSerializer(serializers.Serializer):
# Decode the uidb64 to uid to get User object
try:
uid = force_text(uid_decoder(attrs['uid']))
uid = force_str(uid_decoder(attrs['uid']))
self.user = UserModel._default_manager.get(pk=uid)
except (TypeError, ValueError, OverflowError, UserModel.DoesNotExist):
raise ValidationError({'uid': ['Invalid value']})

View File

@ -2,7 +2,7 @@ import json
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
@ -59,7 +59,7 @@ class TestsMixin(object):
self.response.json = {}
if is_json and self.response.content:
self.response.json = json.loads(force_text(self.response.content))
self.response.json = json.loads(force_str(self.response.content))
if status_code:
self.assertEqual(self.response.status_code, status_code)

View File

@ -2,7 +2,7 @@ from django.test import TestCase, override_settings
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
@ -300,7 +300,7 @@ class APIBasicTests(TestsMixin, TestCase):
data = {
'new_password1': self.NEW_PASS,
'new_password2': self.NEW_PASS,
'uid': force_text(url_kwargs['uid']),
'uid': force_str(url_kwargs['uid']),
'token': '-wrong-token-'
}
self.post(url, data=data, status_code=400)
@ -327,7 +327,7 @@ class APIBasicTests(TestsMixin, TestCase):
data = {
'new_password1': self.NEW_PASS,
'new_password2': self.NEW_PASS,
'uid': force_text(url_kwargs['uid']),
'uid': force_str(url_kwargs['uid']),
'token': url_kwargs['token']
}
url = reverse('rest_password_reset_confirm')

View File

@ -6,7 +6,7 @@ from django.conf import settings
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

View File

@ -12,7 +12,7 @@ f.close()
setup(
name='django-rest-auth',
version='0.9.5',
version='1.0.0',
author='Sumit Chachra',
author_email='chachra@tivix.com',
url='http://github.com/Tivix/django-rest-auth',
@ -22,7 +22,7 @@ setup(
keywords='django rest auth registration rest-framework django-registration api',
zip_safe=False,
install_requires=[
'Django>=1.8.0',
'Django>=5.1',
'djangorestframework>=3.1.3',
'six>=1.9.0',
],