Skip to content

Commit 6dc9b44

Browse files
committed
Chore: remove all code in pagination.py that causes DRF317Warning
1 parent 6c74508 commit 6dc9b44

File tree

1 file changed

+0
-92
lines changed

1 file changed

+0
-92
lines changed

rest_framework/pagination.py

Lines changed: 0 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,6 @@ def to_html(self): # pragma: no cover
151151
def get_results(self, data):
152152
return data['results']
153153

154-
def get_schema_fields(self, view):
155-
assert coreapi is not None, 'coreapi must be installed to use `get_schema_fields()`'
156-
if coreapi is not None:
157-
warnings.warn('CoreAPI compatibility is deprecated and will be removed in DRF 3.17', RemovedInDRF317Warning)
158-
return []
159-
160154
def get_schema_operation_parameters(self, view):
161155
return []
162156

@@ -313,36 +307,6 @@ def to_html(self):
313307
context = self.get_html_context()
314308
return template.render(context)
315309

316-
def get_schema_fields(self, view):
317-
assert coreapi is not None, 'coreapi must be installed to use `get_schema_fields()`'
318-
if coreapi is not None:
319-
warnings.warn('CoreAPI compatibility is deprecated and will be removed in DRF 3.17', RemovedInDRF317Warning)
320-
assert coreschema is not None, 'coreschema must be installed to use `get_schema_fields()`'
321-
fields = [
322-
coreapi.Field(
323-
name=self.page_query_param,
324-
required=False,
325-
location='query',
326-
schema=coreschema.Integer(
327-
title='Page',
328-
description=force_str(self.page_query_description)
329-
)
330-
)
331-
]
332-
if self.page_size_query_param is not None:
333-
fields.append(
334-
coreapi.Field(
335-
name=self.page_size_query_param,
336-
required=False,
337-
location='query',
338-
schema=coreschema.Integer(
339-
title='Page size',
340-
description=force_str(self.page_size_query_description)
341-
)
342-
)
343-
)
344-
return fields
345-
346310
def get_schema_operation_parameters(self, view):
347311
parameters = [
348312
{
@@ -530,32 +494,6 @@ def get_count(self, queryset):
530494
except (AttributeError, TypeError):
531495
return len(queryset)
532496

533-
def get_schema_fields(self, view):
534-
assert coreapi is not None, 'coreapi must be installed to use `get_schema_fields()`'
535-
if coreapi is not None:
536-
warnings.warn('CoreAPI compatibility is deprecated and will be removed in DRF 3.17', RemovedInDRF317Warning)
537-
assert coreschema is not None, 'coreschema must be installed to use `get_schema_fields()`'
538-
return [
539-
coreapi.Field(
540-
name=self.limit_query_param,
541-
required=False,
542-
location='query',
543-
schema=coreschema.Integer(
544-
title='Limit',
545-
description=force_str(self.limit_query_description)
546-
)
547-
),
548-
coreapi.Field(
549-
name=self.offset_query_param,
550-
required=False,
551-
location='query',
552-
schema=coreschema.Integer(
553-
title='Offset',
554-
description=force_str(self.offset_query_description)
555-
)
556-
)
557-
]
558-
559497
def get_schema_operation_parameters(self, view):
560498
parameters = [
561499
{
@@ -933,36 +871,6 @@ def to_html(self):
933871
context = self.get_html_context()
934872
return template.render(context)
935873

936-
def get_schema_fields(self, view):
937-
assert coreapi is not None, 'coreapi must be installed to use `get_schema_fields()`'
938-
if coreapi is not None:
939-
warnings.warn('CoreAPI compatibility is deprecated and will be removed in DRF 3.17', RemovedInDRF317Warning)
940-
assert coreschema is not None, 'coreschema must be installed to use `get_schema_fields()`'
941-
fields = [
942-
coreapi.Field(
943-
name=self.cursor_query_param,
944-
required=False,
945-
location='query',
946-
schema=coreschema.String(
947-
title='Cursor',
948-
description=force_str(self.cursor_query_description)
949-
)
950-
)
951-
]
952-
if self.page_size_query_param is not None:
953-
fields.append(
954-
coreapi.Field(
955-
name=self.page_size_query_param,
956-
required=False,
957-
location='query',
958-
schema=coreschema.Integer(
959-
title='Page size',
960-
description=force_str(self.page_size_query_description)
961-
)
962-
)
963-
)
964-
return fields
965-
966874
def get_schema_operation_parameters(self, view):
967875
parameters = [
968876
{

0 commit comments

Comments
 (0)