From e5fbe6baba52bcb55fcbfb149773a24136246e75 Mon Sep 17 00:00:00 2001 From: tgoddessana Date: Fri, 21 Mar 2025 18:46:05 +0900 Subject: [PATCH] Chore: remove all code in pagination.py that causes DRF317Warning --- rest_framework/pagination.py | 92 ------------------------------------ 1 file changed, 92 deletions(-) diff --git a/rest_framework/pagination.py b/rest_framework/pagination.py index a543ceeb5..fbd47f9f4 100644 --- a/rest_framework/pagination.py +++ b/rest_framework/pagination.py @@ -151,12 +151,6 @@ class BasePagination: def get_results(self, data): return data['results'] - def get_schema_fields(self, view): - assert coreapi is not None, 'coreapi must be installed to use `get_schema_fields()`' - if coreapi is not None: - warnings.warn('CoreAPI compatibility is deprecated and will be removed in DRF 3.17', RemovedInDRF317Warning) - return [] - def get_schema_operation_parameters(self, view): return [] @@ -313,36 +307,6 @@ class PageNumberPagination(BasePagination): context = self.get_html_context() return template.render(context) - def get_schema_fields(self, view): - assert coreapi is not None, 'coreapi must be installed to use `get_schema_fields()`' - if coreapi is not None: - warnings.warn('CoreAPI compatibility is deprecated and will be removed in DRF 3.17', RemovedInDRF317Warning) - assert coreschema is not None, 'coreschema must be installed to use `get_schema_fields()`' - fields = [ - coreapi.Field( - name=self.page_query_param, - required=False, - location='query', - schema=coreschema.Integer( - title='Page', - description=force_str(self.page_query_description) - ) - ) - ] - if self.page_size_query_param is not None: - fields.append( - coreapi.Field( - name=self.page_size_query_param, - required=False, - location='query', - schema=coreschema.Integer( - title='Page size', - description=force_str(self.page_size_query_description) - ) - ) - ) - return fields - def get_schema_operation_parameters(self, view): parameters = [ { @@ -530,32 +494,6 @@ class LimitOffsetPagination(BasePagination): except (AttributeError, TypeError): return len(queryset) - def get_schema_fields(self, view): - assert coreapi is not None, 'coreapi must be installed to use `get_schema_fields()`' - if coreapi is not None: - warnings.warn('CoreAPI compatibility is deprecated and will be removed in DRF 3.17', RemovedInDRF317Warning) - assert coreschema is not None, 'coreschema must be installed to use `get_schema_fields()`' - return [ - coreapi.Field( - name=self.limit_query_param, - required=False, - location='query', - schema=coreschema.Integer( - title='Limit', - description=force_str(self.limit_query_description) - ) - ), - coreapi.Field( - name=self.offset_query_param, - required=False, - location='query', - schema=coreschema.Integer( - title='Offset', - description=force_str(self.offset_query_description) - ) - ) - ] - def get_schema_operation_parameters(self, view): parameters = [ { @@ -933,36 +871,6 @@ class CursorPagination(BasePagination): context = self.get_html_context() return template.render(context) - def get_schema_fields(self, view): - assert coreapi is not None, 'coreapi must be installed to use `get_schema_fields()`' - if coreapi is not None: - warnings.warn('CoreAPI compatibility is deprecated and will be removed in DRF 3.17', RemovedInDRF317Warning) - assert coreschema is not None, 'coreschema must be installed to use `get_schema_fields()`' - fields = [ - coreapi.Field( - name=self.cursor_query_param, - required=False, - location='query', - schema=coreschema.String( - title='Cursor', - description=force_str(self.cursor_query_description) - ) - ) - ] - if self.page_size_query_param is not None: - fields.append( - coreapi.Field( - name=self.page_size_query_param, - required=False, - location='query', - schema=coreschema.Integer( - title='Page size', - description=force_str(self.page_size_query_description) - ) - ) - ) - return fields - def get_schema_operation_parameters(self, view): parameters = [ {