From 38114d0c34f48df9e9fb7115f11f7a1a92d90201 Mon Sep 17 00:00:00 2001 From: Ekaterina Vititneva Date: Fri, 2 Aug 2024 17:24:26 +0200 Subject: [PATCH] Update views.py --- project_1/wiki/encyclopedia/views.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/project_1/wiki/encyclopedia/views.py b/project_1/wiki/encyclopedia/views.py index 4211c49..e13b04b 100644 --- a/project_1/wiki/encyclopedia/views.py +++ b/project_1/wiki/encyclopedia/views.py @@ -37,8 +37,9 @@ def search(request): if not query: return redirect('index') - entries = [entry.lower() for entry in util.list_entries()] - if query.lower() in entries: + entries = util.list_entries() + entries_lower = [entry.lower() for entry in entries] + if query.lower() in entries_lower: return redirect('title_1', title=query) results = [entry for entry in entries if query.lower() in entry.lower()] return render(request, "encyclopedia/search.html", {