Fixes error on empty search results

This commit is contained in:
Mouse Reeve 2021-05-01 22:20:23 -07:00
parent ddf5022970
commit db6246e359

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)