From 02063f09187454abe53ea8e3bd6a9da109f2725c Mon Sep 17 00:00:00 2001 From: Pavel Dedik Date: Mon, 24 Aug 2026 14:24:04 +0200 Subject: [PATCH] Drop CoreAPI schemas from rest_framework_auth views djangorestframework 3.17 removed coreapi/coreschema from rest_framework.compat and ManualSchema from rest_framework.schemas, so importing them breaks on 3.17+. --- .../contrib/rest_framework_auth/views.py | 74 ------------------- auth_token/version.py | 2 +- example/requirements.txt | 2 +- 3 files changed, 2 insertions(+), 76 deletions(-) diff --git a/auth_token/contrib/rest_framework_auth/views.py b/auth_token/contrib/rest_framework_auth/views.py index 2ec6f39..12d1179 100644 --- a/auth_token/contrib/rest_framework_auth/views.py +++ b/auth_token/contrib/rest_framework_auth/views.py @@ -1,9 +1,7 @@ from auth_token.contrib.common.views import LoginView as _LoginView from auth_token.contrib.common.views import LogoutView as _LogoutView from auth_token.utils import login, logout -from rest_framework.compat import coreapi, coreschema from rest_framework.response import Response -from rest_framework.schemas import ManualSchema from rest_framework.views import APIView from .serializers import ( @@ -17,39 +15,6 @@ class LoginAuthToken(APIView): permission_classes = () authentication_classes = () serializer_class = AuthTokenSerializer - if coreapi is not None and coreschema is not None: - schema = ManualSchema( - fields=[ - coreapi.Field( - name='username', - required=True, - location='form', - schema=coreschema.String( - title='Username', - description='Valid username for authentication', - ), - ), - coreapi.Field( - name='password', - required=True, - location='form', - schema=coreschema.String( - title='Password', - description='Valid password for authentication', - ), - ), - coreapi.Field( - name='permanent', - required=False, - location='form', - schema=coreschema.Boolean( - title='Permanent', - description='Define if login can expire', - ), - ), - ], - encoding='application/json', - ) allowed_cookie = False allowed_header = True @@ -71,30 +36,6 @@ class MobileLoginAuthToken(APIView): permission_classes = () authentication_classes = () serializer_class = MobileAuthTokenSerializer - if coreapi is not None and coreschema is not None: - schema = ManualSchema( - fields=[ - coreapi.Field( - name='uuid', - required=True, - location='form', - schema=coreschema.String( - title='Device UUID', - description='Valid device UUID for authentication', - ), - ), - coreapi.Field( - name='login_device_token', - required=True, - location='form', - schema=coreschema.String( - title='Password', - description='Valid token for authentication', - ), - ), - ], - encoding='application/json', - ) allowed_cookie = False allowed_header = True @@ -122,21 +63,6 @@ def delete(self, request, *args, **kwargs): class MobileRegisterToken(APIView): serializer_class = MobileAuthTokenRegisterSerializer - if coreapi is not None and coreschema is not None: - schema = ManualSchema( - fields=[ - coreapi.Field( - name='uuid', - required=True, - location='form', - schema=coreschema.String( - title='Device UUID', - description='Valid device UUID for authentication', - ), - ), - ], - encoding='application/json', - ) def post(self, request, *args, **kwargs): serializer = self.serializer_class(data=request.data, diff --git a/auth_token/version.py b/auth_token/version.py index 94e7190..1cc9808 100644 --- a/auth_token/version.py +++ b/auth_token/version.py @@ -1,4 +1,4 @@ -VERSION = (0, 7, 1) +VERSION = (0, 7, 2) def get_version(): diff --git a/example/requirements.txt b/example/requirements.txt index 5cc28a0..6507039 100644 --- a/example/requirements.txt +++ b/example/requirements.txt @@ -2,7 +2,7 @@ skip-django-germanium==2.6.0 coveralls flake8 skip-django-is-core==2.29.0 -djangorestframework==3.14.0 +djangorestframework==3.18.0 freezegun==1.0.0 responses==0.22.0 httpretty==1.1.4