Activity 1.02 – a book search scaffold
A useful feature of a site such as Bookr is the ability to search through data to find something on the site quickly. Bookr will implement book searching to allow users to find a particular book by part of its title. While we don’t have any books to find yet, we can still implement a page that shows the text a user searched for. The user enters the search string as part of the URL parameters. We will implement searching and a form for easy text entry in Chapter 6, Forms.
These steps will help you complete the activity:
- Create a search result HTML template. It should include a variable placeholder to show the search word(s) that were passed in through the render context. Show the passed-in variable in the
<title>
and<h1>
tags. Use an<em>
tag around the search text in the body to make it italic. - Add a search view function in
views.py
. The view should read a search string from the URL parameters (in...