1
0
Fork 0

Merge pull request #1037 from bookwyrm-social/search-bug

Fixes error on empty search results
This commit is contained in:
Mouse Reeve 2021-05-03 10:57:53 -07:00 committed by GitHub
commit 7db8e249cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View file

@ -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)