For the Wiki project I'm having trouble implementing the search bar. I have spent about 2 days researching search bars in Django, but so far everything I've tried yields the same result:
No matter what I try, when I search for an article name that exists, the homepage just stays exactly the same, but only the URL changes to http://127.0.0.1:8000/?q=Apple. So for example, everything after the ?q= is the title of the article (this one is called Apple). But the page I'm on stays the same and doesn't go to the actual page I'm looking for. I'm wondering if the url is part of the problem because I know other search bars have the end of the url looking like: Search?q=Apple
urlpatterns = [
path("", views.index, name="index"),
path("wiki/<str:title>", views.entry, name="entry"),
path("search", views.search, name="search"),
]
If the query matches the title of an article entry, the user should be redirected to that entry’s page. Here is one of the examples I tried and all code associated in views.py: