Skip to content

Commit

Permalink
detect empty queryset
Browse files Browse the repository at this point in the history
  • Loading branch information
smilerz committed Jan 12, 2022
1 parent 22953b0 commit 798aa7f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cookbook/helper/recipe_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def __init__(self, request, queryset=None, hash_key=None, cache_timeout=3600):
self.Ratings = self._cache.get('Ratings', None)
self.Recent = self._cache.get('Recent', None)

if self._queryset:
if self._queryset is not None:
self._recipe_list = list(self._queryset.values_list('id', flat=True))
self._search_params = {
'keyword_list': self._request.query_params.getlist('keywords', []),
Expand All @@ -235,7 +235,7 @@ def __init__(self, request, queryset=None, hash_key=None, cache_timeout=3600):
'search_books_or': str2bool(self._request.query_params.get('books_or', True)),
'space': self._request.space,
}
elif self.hash_key:
elif self.hash_key is not None:
self._recipe_list = self._cache.get('recipe_list', None)
self._search_params = {
'keyword_list': self._cache.get('keyword_list', None),
Expand Down

0 comments on commit 798aa7f

Please sign in to comment.