Skip to content

Commit

Permalink
Merge branch 'master' into collection_expansions
Browse files Browse the repository at this point in the history
  • Loading branch information
snyaggarwal committed Dec 20, 2021
2 parents 4df42b4 + 2c98e2d commit eae2acd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion core/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
API_VERSION = '2.0.98'
API_VERSION = '2.0.99'
API_BUILD = 'dev'
VERSION = API_VERSION + '-' + API_BUILD
__version__ = VERSION
4 changes: 2 additions & 2 deletions core/common/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class ListWithHeadersMixin(ListModelMixin):
document_model = None

def head(self, request, **kwargs): # pylint: disable=unused-argument
queryset = self.filter_queryset(self.get_queryset())
queryset = self.filter_queryset()
res = Response()
res['num_found'] = get(self, 'total_count') or queryset.count()
return res
Expand All @@ -116,7 +116,7 @@ def list(self, request, *args, **kwargs): # pylint:disable=too-many-locals
return Response(dict(facets=dict(fields=self.get_facets())))

if self.object_list is None:
self.object_list = self.filter_queryset(self.get_queryset())
self.object_list = self.filter_queryset()

if is_csv and search_string:
klass = type(self.object_list[0])
Expand Down
5 changes: 4 additions & 1 deletion core/common/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,13 @@ def destroy(self, request, *args, **kwargs): # pylint: disable=unused-argument
def get_host_url(self):
return self.request.META['wsgi.url_scheme'] + '://' + self.request.get_host()

def filter_queryset(self, queryset):
def filter_queryset(self, queryset=None):
if self.is_searchable and self.should_perform_es_search():
return self.get_search_results_qs()

if queryset is None:
queryset = self.get_queryset()

return super().filter_queryset(queryset).order_by(self.default_qs_sort_attr)

def get_sort_and_desc(self):
Expand Down

0 comments on commit eae2acd

Please sign in to comment.