  import django_filters
  
  factory = RequestFactory()
  
  # Basic filter on a list view.
  class FilterFieldsRootView(generics.ListCreateAPIView):
      model = FilterableItem
      filter_fields = ['decimal', 'date']
  
  
  # These class are used to test a filter class.
  class SeveralFieldsFilter(django_filters.FilterSet):
      text = django_filters.CharFilter(lookup_type='icontains')
 
</s> remove 
# These class are used to test a filter class.
class SeveralFieldsFilter(django_filters.FilterSet):
    text = django_filters.CharFilter(lookup_type='icontains')
    decimal = django_filters.NumberFilter(lookup_type='lt')
    date = django_filters.DateFilter(lookup_type='gt')
    class Meta:
 </s> add if django_filters:
    # Basic filter on a list view.
    class FilterFieldsRootView(generics.ListCreateAPIView): </s> remove # These classes are used to test a misconfigured filter class.
class MisconfiguredFilter(django_filters.FilterSet):
    text = django_filters.CharFilter(lookup_type='icontains')
    class Meta:
        model = BasicModel
        fields = ['text']
 </s> add     # These classes are used to test a misconfigured filter class.
    class MisconfiguredFilter(django_filters.FilterSet):
        text = django_filters.CharFilter(lookup_type='icontains') </s> remove class FilterClassRootView(generics.ListCreateAPIView):
    model = FilterableItem
    filter_class = SeveralFieldsFilter
 </s> add         class Meta:
            model = FilterableItem
            fields = ['text', 'decimal', 'date']
  import django_filters
  
  factory = RequestFactory()
  




  
  
  # These class are used to test a filter class.
  class SeveralFieldsFilter(django_filters.FilterSet):
      text = django_filters.CharFilter(lookup_type='icontains')
keep keep keep keep replace replace replace replace keep keep keep keep keep
 Make filtering optional, and pluggable. 
rest_framework/tests/filterset.py