mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-27 03:51:08 +00:00
Merge pull request #1037 from bookwyrm-social/search-bug
Fixes error on empty search results
This commit is contained in:
commit
7db8e249cc
2 changed files with 6 additions and 5 deletions
|
@ -127,7 +127,7 @@ class Views(TestCase):
|
|||
response = view(request)
|
||||
|
||||
response.render()
|
||||
self.assertEqual(response.context_data["results"].object_list.count(), 0)
|
||||
self.assertFalse("results" in response.context_data)
|
||||
|
||||
def test_search_lists(self):
|
||||
"""searches remote connectors"""
|
||||
|
|
|
@ -56,10 +56,11 @@ class Search(View):
|
|||
results = endpoints[search_type](
|
||||
query, request.user, min_confidence, search_remote
|
||||
)
|
||||
paginated = Paginator(results, PAGE_LENGTH).get_page(
|
||||
request.GET.get("page")
|
||||
)
|
||||
data["results"] = paginated
|
||||
if results:
|
||||
paginated = Paginator(results, PAGE_LENGTH).get_page(
|
||||
request.GET.get("page")
|
||||
)
|
||||
data["results"] = paginated
|
||||
|
||||
return TemplateResponse(request, "search/{:s}.html".format(search_type), data)
|
||||
|
||||
|
|
Loading…
Reference in a new issue