OrderingFilter has no attribute 'filter_queryset'
<p>I have been trying to get <a href="http://www.django-rest-framework.org/api-guide/filtering/#orderingfilter" rel="noreferrer">OrderingFilter</a> to work. From the example in django-rest-framework's page, it seems it should be fairly straightforward:</p>

<pre><code>class UserListView(generics.ListAPIView):
    queryset = User.objects.all()
    serializer_class = UserSerializer
    filter_backends = (filters.OrderingFilter,)
    ordering_fields = ('username', 'email')
</code></pre>

<p>However, when I try to do that:</p>

<pre><code>from django_filters.rest_framework import DjangoFilterBackend, FilterSet, OrderingFilter
...


class ListingViewSet(viewsets.ModelViewSet):
    queryset = Listing.objects.all()
    serializer_class = ListingSerializer
    filter_backends = (DjangoFilterBackend, OrderingFilter,)
    filter_class = ListFilter
    ordering_fields = ('price', 'views')
    ordering = ('price',)
</code></pre>

<p>I get an error about <code>OrderingFilter</code> not having a <code>filter_queryset</code> attribute:</p>

<pre><code>ERROR 2016-11-13 03:14:57,304 log 25913 123145338523648 (&lt;class 'AttributeError'&gt;, AttributeError("'OrderingFilter' object has no attribute 'filter_queryset'",), &lt;traceback object at 0x106ef48c8&gt;)
Traceback (most recent call last):
  File "/.../lib/python3.5/site-packages/rest_framework/views.py", line 474, in dispatch
    response = handler(request, *args, **kwargs)
  File "/.../lib/python3.5/site-packages/rest_framework/mixins.py", line 40, in list
    queryset = self.filter_queryset(self.get_queryset())
  File "/.../lib/python3.5/site-packages/rest_framework/generics.py", line 151, in filter_queryset
    queryset = backend().filter_queryset(self.request, queryset, self)
AttributeError: 'OrderingFilter' object has no attribute 'filter_queryset'
</code></pre>

<p>Going into <code>OrderingFilter</code>, it indeed does not have a <code>filter_queryset</code> method, but the view expects it:</p>

<pre><code># in GenericAPIView(views.APIView)
def filter_queryset(self, queryset):
    """
    Given a queryset, filter it with whichever filter backend is in use.

    You are unlikely to want to override this method, although you may need
    to call it either from a list view, or from a custom `get_object`
    method if you want to apply the configured filtering backend to the
    default queryset.
    """
    for backend in list(self.filter_backends):
        queryset = backend().filter_queryset(self.request, queryset, self)
    return queryset
</code></pre>

<p>I have tried the various solutions in <a href="https://stackoverflow.com/questions/24987446/django-rest-framework-queryset-doesnt-order">django rest framework queryset doesn&#39;t order</a>, but it seems they do not work, either. I tried updating the most promising answer:</p>

<pre><code>class YOUR_VIEW_SET(viewsets.ModelViewSet):
    #your code here
    ordering_filter = OrderingFilter()

    def filter_queryset(self, queryset):
        queryset = super(YOUR_VIEW_SET, self).filter_queryset(queryset)
        return self.ordering_filter.filter_queryset(self.request, queryset, self)
</code></pre>

<p>Since <code>OrderingFilter</code> does not have a <code>filter_queryset</code> method, I changed <code>filter_queryset</code> to <code>filter</code> (which it does have), but this call seems to clash with the signature of <code>filter</code> in <code>OrderingFilter</code>: </p>

<pre><code># In OrderingFilter(BaseCSVFilter, ChoiceFilter)
def filter(self, qs, value):
    if value in EMPTY_VALUES:
        return qs

    ordering = [self.get_ordering_value(param) for param in value]
    return qs.order_by(*ordering)
</code></pre>

<p>I have no idea what <code>value</code> in the function declaration is supposed to be so I could try to pass it to the function, but it seems <code>qs</code> refers to the queryset, so I assume that should be the first argument instead of the second, but again, I am not entirely sure what <code>value</code> would be; it doesn't seem to be request because it is not iterable.</p>

<p>I would appreciate any pointers or ideas, or workarounds, and I apologize if I missed something obvious; I am not terribly familiar with Django.</p>