A single search result ends in a redirect to the page

This commit is contained in:
Dirk Alders 2024-10-25 19:23:14 +02:00
parent b30d86a21d
commit a6277fc1e2

View File

@ -270,6 +270,9 @@ def search(request):
if sr is None: if sr is None:
django_messages.error(request, _('Invalid search pattern: %s') % repr(search_txt)) django_messages.error(request, _('Invalid search pattern: %s') % repr(search_txt))
sr = [] sr = []
if len(sr) == 1:
return HttpResponseRedirect(url_page(sr[0]))
else:
pl = page_list([PikiPage.objects.get(rel_path=rel_path) for rel_path in set(sr)]) pl = page_list([PikiPage.objects.get(rel_path=rel_path) for rel_path in set(sr)])
# #
context_adaption( context_adaption(