Reputation: 1005
I am using Django ModelViewSet. If I pass ?ordering=some-field
in the url, when is it applied on my queryset at the django level? I would need to catch some specific behavior there.
Upvotes: 0
Views: 55
Reputation: 6296
In the filter_queryset
method, each filter backend in the list of filter_backends
is called and the queryset is passed to it. I assume you're using the DRF OrderingFilter
which is a filter backend. So that is where it is called and the queryset is ordered.
You can check the OrderingFilter
class to see how you can modify/override the behaviour
Upvotes: 1