Ordering cursor pagination with Django-Rest
<p>I'm building an API with Django-Rest-Framework and set the cursor pagination - by default ordered by 'created' filter, what work really fine to some views.</p>

<p>But I have this one that I want order by other fields (last_update and visits). I put the ordering field in my view, but doesn't work.</p>

<pre><code>class StationList(generics.ListAPIView):

    """
    List all stations.
    """
    ordering = ('-last_update', '-visits',)
    queryset = Station.objects.all()
    serializer_class = StationSerializer
    permission_classes = (permissions.IsAuthenticated,)
</code></pre>

<p>That is part of my setting.py</p>

<pre><code>REST_FRAMEWORK = {
    'DEFAULT_RENDERER_CLASSES': (
        'rest_framework.renderers.JSONRenderer',
    ),
    'DEFAULT_AUTHENTICATION_CLASSES': (
        'rest_framework.authentication.SessionAuthentication',
        'rest_framework.authentication.TokenAuthentication',
    ),
    'DEFAULT_PERMISSION_CLASSES': (
        'rest_framework.permissions.AllowAny',
    ),
    'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.CursorPagination',
    'PAGE_SIZE': 12,
}
</code></pre>

<p>What I need to do to it works?</p>