Search
- To add pagination to the search result see the pagination and sorting section.
- Using POST in search makes it more secure, but using GET allows users to bookmark results.
Search using GET
navbar.html: add the following code to the navbar.py file:
urls.py
views.py (using __icontains=query.strip().lower() will ensure that both user input and model data are case insensitive)
Template: create a new search_result.html file:
Search using POST
Here is how to implement search using POST
navbar.html: add the following code to the navbar.py file:
urls.py
views.py (using __icontains=query.strip().lower() will ensure that both user input and model data are case insensitive)
Template: create a new search_result.html file: