I have a viewset lets say TestingViewSet which has a default ordering field id.
class TestingViewSet(viewsets.ReadOnlyViewSet):
filter_backends = (
django_filters.rest_framework.DjangoFilterBackend,
filters.OrderingFilter,
)
ordering = ('id',)
But there as some custom action views that uses the super(TestingViewSet).list that i want to change the ordering field for them conditionally e.x
def distinct_list(self, request):
return super(TestingViewSet, self).list(request)
Is there a way like to change the ordering field of function distinct_list only?