mirror of
https://github.com/Tivix/django-rest-auth.git
synced 2025-06-17 19:33:11 +03:00
Removed depricated django imports - support for django 5
This commit is contained in:
parent
cdd04aa9be
commit
d6f2c2c79d
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -24,6 +24,7 @@ wheels/
|
||||||
.installed.cfg
|
.installed.cfg
|
||||||
*.egg
|
*.egg
|
||||||
MANIFEST
|
MANIFEST
|
||||||
|
.idea/
|
||||||
|
|
||||||
# PyInstaller
|
# PyInstaller
|
||||||
# Usually these files are written by a python script from a template
|
# Usually these files are written by a python script from a template
|
||||||
|
|
|
@ -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:
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
@ -205,7 +205,7 @@ class PasswordResetConfirmSerializer(serializers.Serializer):
|
||||||
|
|
||||||
# Decode the uidb64 to uid to get User object
|
# Decode the uidb64 to uid to get User object
|
||||||
try:
|
try:
|
||||||
uid = force_text(uid_decoder(attrs['uid']))
|
uid = force_str(uid_decoder(attrs['uid']))
|
||||||
self.user = UserModel._default_manager.get(pk=uid)
|
self.user = UserModel._default_manager.get(pk=uid)
|
||||||
except (TypeError, ValueError, OverflowError, UserModel.DoesNotExist):
|
except (TypeError, ValueError, OverflowError, UserModel.DoesNotExist):
|
||||||
raise ValidationError({'uid': ['Invalid value']})
|
raise ValidationError({'uid': ['Invalid value']})
|
||||||
|
|
|
@ -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
|
||||||
|
@ -59,7 +59,7 @@ class TestsMixin(object):
|
||||||
|
|
||||||
self.response.json = {}
|
self.response.json = {}
|
||||||
if is_json and self.response.content:
|
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:
|
if status_code:
|
||||||
self.assertEqual(self.response.status_code, status_code)
|
self.assertEqual(self.response.status_code, status_code)
|
||||||
|
|
|
@ -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
|
||||||
|
@ -300,7 +300,7 @@ class APIBasicTests(TestsMixin, TestCase):
|
||||||
data = {
|
data = {
|
||||||
'new_password1': self.NEW_PASS,
|
'new_password1': self.NEW_PASS,
|
||||||
'new_password2': self.NEW_PASS,
|
'new_password2': self.NEW_PASS,
|
||||||
'uid': force_text(url_kwargs['uid']),
|
'uid': force_str(url_kwargs['uid']),
|
||||||
'token': '-wrong-token-'
|
'token': '-wrong-token-'
|
||||||
}
|
}
|
||||||
self.post(url, data=data, status_code=400)
|
self.post(url, data=data, status_code=400)
|
||||||
|
@ -327,7 +327,7 @@ class APIBasicTests(TestsMixin, TestCase):
|
||||||
data = {
|
data = {
|
||||||
'new_password1': self.NEW_PASS,
|
'new_password1': self.NEW_PASS,
|
||||||
'new_password2': self.NEW_PASS,
|
'new_password2': self.NEW_PASS,
|
||||||
'uid': force_text(url_kwargs['uid']),
|
'uid': force_str(url_kwargs['uid']),
|
||||||
'token': url_kwargs['token']
|
'token': url_kwargs['token']
|
||||||
}
|
}
|
||||||
url = reverse('rest_password_reset_confirm')
|
url = reverse('rest_password_reset_confirm')
|
||||||
|
|
|
@ -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
|
||||||
|
|
4
setup.py
4
setup.py
|
@ -12,7 +12,7 @@ f.close()
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='django-rest-auth',
|
name='django-rest-auth',
|
||||||
version='0.9.5',
|
version='1.0.0',
|
||||||
author='Sumit Chachra',
|
author='Sumit Chachra',
|
||||||
author_email='chachra@tivix.com',
|
author_email='chachra@tivix.com',
|
||||||
url='http://github.com/Tivix/django-rest-auth',
|
url='http://github.com/Tivix/django-rest-auth',
|
||||||
|
@ -22,7 +22,7 @@ setup(
|
||||||
keywords='django rest auth registration rest-framework django-registration api',
|
keywords='django rest auth registration rest-framework django-registration api',
|
||||||
zip_safe=False,
|
zip_safe=False,
|
||||||
install_requires=[
|
install_requires=[
|
||||||
'Django>=1.8.0',
|
'Django>=5.1',
|
||||||
'djangorestframework>=3.1.3',
|
'djangorestframework>=3.1.3',
|
||||||
'six>=1.9.0',
|
'six>=1.9.0',
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in New Issue
Block a user