From 409d784ce8369b659443ec8e5accb8fbc86e635f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Kr=C3=B6nke?= Date: Mon, 8 Apr 2024 12:24:24 +0200 Subject: [PATCH] Last ordering filter has the last say --- rest_framework/pagination.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rest_framework/pagination.py b/rest_framework/pagination.py index 2b20e76af5..5789c74c77 100644 --- a/rest_framework/pagination.py +++ b/rest_framework/pagination.py @@ -822,8 +822,8 @@ def get_ordering(self, request, queryset, view): if ordering_filters: # If a filter exists on the view that implements `get_ordering` - # then we defer to that filter to determine the ordering. - filter_cls = ordering_filters[0] + # then we defer to the last such filter to determine the ordering. + filter_cls = ordering_filters[-1] filter_instance = filter_cls() ordering_from_filter = filter_instance.get_ordering(request, queryset, view) if ordering_from_filter: