mirror of
				https://github.com/encode/django-rest-framework.git
				synced 2025-11-04 09:57:55 +03:00 
			
		
		
		
	Chore: remove all code in filters.py that causes DRF317Warning
This commit is contained in:
		
							parent
							
								
									265c8a98a2
								
							
						
					
					
						commit
						39a258bfab
					
				| 
						 | 
				
			
			@ -48,13 +48,6 @@ class BaseFilterBackend:
 | 
			
		|||
        """
 | 
			
		||||
        raise NotImplementedError(".filter_queryset() must be overridden.")
 | 
			
		||||
 | 
			
		||||
    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 []
 | 
			
		||||
 | 
			
		||||
    def get_schema_operation_parameters(self, view):
 | 
			
		||||
        return []
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -186,23 +179,6 @@ class SearchFilter(BaseFilterBackend):
 | 
			
		|||
        template = loader.get_template(self.template)
 | 
			
		||||
        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()`'
 | 
			
		||||
        return [
 | 
			
		||||
            coreapi.Field(
 | 
			
		||||
                name=self.search_param,
 | 
			
		||||
                required=False,
 | 
			
		||||
                location='query',
 | 
			
		||||
                schema=coreschema.String(
 | 
			
		||||
                    title=force_str(self.search_title),
 | 
			
		||||
                    description=force_str(self.search_description)
 | 
			
		||||
                )
 | 
			
		||||
            )
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
    def get_schema_operation_parameters(self, view):
 | 
			
		||||
        return [
 | 
			
		||||
            {
 | 
			
		||||
| 
						 | 
				
			
			@ -280,9 +256,9 @@ class OrderingFilter(BaseFilterBackend):
 | 
			
		|||
            (field.source.replace('.', '__') or field_name, field.label)
 | 
			
		||||
            for field_name, field in serializer_class(context=context).fields.items()
 | 
			
		||||
            if (
 | 
			
		||||
                not getattr(field, 'write_only', False) and
 | 
			
		||||
                not field.source == '*' and
 | 
			
		||||
                field.source not in model_property_names
 | 
			
		||||
                    not getattr(field, 'write_only', False) and
 | 
			
		||||
                    not field.source == '*' and
 | 
			
		||||
                    field.source not in model_property_names
 | 
			
		||||
            )
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -348,23 +324,6 @@ class OrderingFilter(BaseFilterBackend):
 | 
			
		|||
        context = self.get_template_context(request, queryset, view)
 | 
			
		||||
        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()`'
 | 
			
		||||
        return [
 | 
			
		||||
            coreapi.Field(
 | 
			
		||||
                name=self.ordering_param,
 | 
			
		||||
                required=False,
 | 
			
		||||
                location='query',
 | 
			
		||||
                schema=coreschema.String(
 | 
			
		||||
                    title=force_str(self.ordering_title),
 | 
			
		||||
                    description=force_str(self.ordering_description)
 | 
			
		||||
                )
 | 
			
		||||
            )
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
    def get_schema_operation_parameters(self, view):
 | 
			
		||||
        return [
 | 
			
		||||
            {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user