Skip to content

Commit

Permalink
Update views.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Ekaterina-Vititneva committed Aug 2, 2024
1 parent ac73962 commit 38114d0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions project_1/wiki/encyclopedia/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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", {
Expand Down

0 comments on commit 38114d0

Please sign in to comment.