Skip to content

Commit 409d784

Browse files
authored
Last ordering filter has the last say
1 parent 63063da commit 409d784

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

rest_framework/pagination.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -822,8 +822,8 @@ def get_ordering(self, request, queryset, view):
822822

823823
if ordering_filters:
824824
# If a filter exists on the view that implements `get_ordering`
825-
# then we defer to that filter to determine the ordering.
826-
filter_cls = ordering_filters[0]
825+
# then we defer to the last such filter to determine the ordering.
826+
filter_cls = ordering_filters[-1]
827827
filter_instance = filter_cls()
828828
ordering_from_filter = filter_instance.get_ordering(request, queryset, view)
829829
if ordering_from_filter:

0 commit comments

Comments
 (0)