Skip to content

Commit 20cf911

Browse files
committed
Fix issues filter logic
1 parent e048ba5 commit 20cf911

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

readthedocs/projects/filters.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ def __init__(self, *args, **kwargs):
3636
def filter(self, qs, value):
3737
# This is where we use the None value for this custom filter. This
3838
# doesn't work with a standard model filter. Note: ``value`` is always
39-
# an iterable.
40-
if value is None:
39+
# an iterable, but can be empty.
40+
if not value:
4141
value = ['relevance']
4242

4343
# Selectively add anotations as a small query optimization
@@ -54,7 +54,8 @@ def filter(self, qs, value):
5454
# And copy the negative sort lookups, ``value`` might be ``['-recent']``
5555
annotations.update({f'-{key}': value for (key, value) in annotations.items()})
5656

57-
return qs.annotate(annotations.get(*value)).order_by(*value)
57+
annotation = annotations.get(*value)
58+
return qs.annotate(**annotation).order_by(*value)
5859

5960

6061
class ProjectSortOrderingFilter(OrderingFilter):

0 commit comments

Comments
 (0)