  
      paginate_by = api_settings.PAGINATE_BY
      paginate_by_param = api_settings.PAGINATE_BY_PARAM
      pagination_serializer_class = api_settings.DEFAULT_PAGINATION_SERIALIZER_CLASS
      filter_backend = api_settings.FILTER_BACKEND
  
      def filter_queryset(self, queryset):
          """
          Given a queryset, filter it with whichever filter backend is in use.
          """
          if not self.filter_backend:
              return queryset
          backend = self.filter_backend()
          return backend.filter_queryset(self.request, queryset, self)
  
      def get_pagination_serializer(self, page=None):
          """
          Return a serializer instance to use with paginated data.
          """
 
</s> remove         self.object = self.get_object()
 </s> add         queryset = self.get_queryset()
        filtered_queryset = self.filter_queryset(queryset)
        self.object = self.get_object(filtered_queryset)
  
      paginate_by = api_settings.PAGINATE_BY
      paginate_by_param = api_settings.PAGINATE_BY_PARAM
      pagination_serializer_class = api_settings.DEFAULT_PAGINATION_SERIALIZER_CLASS










  
      def get_pagination_serializer(self, page=None):
          """
          Return a serializer instance to use with paginated data.
          """
keep keep keep keep replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
 GenericAPIView now applies filter_backend for list and retrieve api views

Before this commit only the MultipleObjectAPIView would apply a
filter_backend, leaving the SingleObjectAPIView to return objects you
might otherwise expect to have been filtered out.

It's worth mentioning that when a SingleObjectAPIView makes a request
for an object that should be excluded, a 404 is the expected result. 
rest_framework/generics.py