Skip to content

Commit 6c74508

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

File tree

1 file changed

+3
-44
lines changed

1 file changed

+3
-44
lines changed

rest_framework/filters.py

Lines changed: 3 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,6 @@ def filter_queryset(self, request, queryset, view):
4848
"""
4949
raise NotImplementedError(".filter_queryset() must be overridden.")
5050

51-
def get_schema_fields(self, view):
52-
assert coreapi is not None, 'coreapi must be installed to use `get_schema_fields()`'
53-
if coreapi is not None:
54-
warnings.warn('CoreAPI compatibility is deprecated and will be removed in DRF 3.17', RemovedInDRF317Warning)
55-
assert coreschema is not None, 'coreschema must be installed to use `get_schema_fields()`'
56-
return []
57-
5851
def get_schema_operation_parameters(self, view):
5952
return []
6053

@@ -186,23 +179,6 @@ def to_html(self, request, queryset, view):
186179
template = loader.get_template(self.template)
187180
return template.render(context)
188181

189-
def get_schema_fields(self, view):
190-
assert coreapi is not None, 'coreapi must be installed to use `get_schema_fields()`'
191-
if coreapi is not None:
192-
warnings.warn('CoreAPI compatibility is deprecated and will be removed in DRF 3.17', RemovedInDRF317Warning)
193-
assert coreschema is not None, 'coreschema must be installed to use `get_schema_fields()`'
194-
return [
195-
coreapi.Field(
196-
name=self.search_param,
197-
required=False,
198-
location='query',
199-
schema=coreschema.String(
200-
title=force_str(self.search_title),
201-
description=force_str(self.search_description)
202-
)
203-
)
204-
]
205-
206182
def get_schema_operation_parameters(self, view):
207183
return [
208184
{
@@ -280,9 +256,9 @@ def get_default_valid_fields(self, queryset, view, context={}):
280256
(field.source.replace('.', '__') or field_name, field.label)
281257
for field_name, field in serializer_class(context=context).fields.items()
282258
if (
283-
not getattr(field, 'write_only', False) and
284-
not field.source == '*' and
285-
field.source not in model_property_names
259+
not getattr(field, 'write_only', False) and
260+
not field.source == '*' and
261+
field.source not in model_property_names
286262
)
287263
]
288264

@@ -348,23 +324,6 @@ def to_html(self, request, queryset, view):
348324
context = self.get_template_context(request, queryset, view)
349325
return template.render(context)
350326

351-
def get_schema_fields(self, view):
352-
assert coreapi is not None, 'coreapi must be installed to use `get_schema_fields()`'
353-
if coreapi is not None:
354-
warnings.warn('CoreAPI compatibility is deprecated and will be removed in DRF 3.17', RemovedInDRF317Warning)
355-
assert coreschema is not None, 'coreschema must be installed to use `get_schema_fields()`'
356-
return [
357-
coreapi.Field(
358-
name=self.ordering_param,
359-
required=False,
360-
location='query',
361-
schema=coreschema.String(
362-
title=force_str(self.ordering_title),
363-
description=force_str(self.ordering_description)
364-
)
365-
)
366-
]
367-
368327
def get_schema_operation_parameters(self, view):
369328
return [
370329
{

0 commit comments

Comments
 (0)