Skip to content

Commit 36119ca

Browse files
tallosanlovelydinosaur
authored andcommitted
Enable OrderingFilter to handle an empty tuple (or list) for the 'ordering' field. (#5899)
1 parent a507277 commit 36119ca

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

rest_framework/filters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ def filter_queryset(self, request, queryset, view):
242242

243243
def get_template_context(self, request, queryset, view):
244244
current = self.get_ordering(request, queryset, view)
245-
current = None if current is None else current[0]
245+
current = None if not current else current[0]
246246
options = []
247247
context = {
248248
'request': request,

0 commit comments

Comments
 (0)