1. Create a SEARCH functionality. Go to CARS\URLS.PY and create a new path.
2. Create a new function in the CARS\VIEWS.PY
3. Create a new HTML file, TEMPLATES\CARS\SEARCH.HTML and create a simple code
4. Test it. In the the browser, type 127.0.0.1:8000\CARS\SEARCH
5. Update the HOME.HTML to create a link to SEARCH.HTL
FROM:
TO:
So, when you search for something like 'SUV,' the search result will be like this with KEYWORD = 'SUV'
6. Add the Django tags and Copy the code of SEARCH.HTML from the RESOURCE folder.
{% extends 'base.html' %}
{% block content %}
<we add our OWN code here?
{% endblock %}
7. Update SEARCH.HTML to remove duplicate blocks of car items.
8. Update the VIEWS.PY
9. Update the SEARCH.HTML with the Django tags to call all dynamic data. This is similar to displaying your LATEST CARS (CARS.HTML)
10. Now, make the filter or search functionality work Update the VIEWS.PY as. This searches the cars using the DESCRIPTION FIELD if it contains what was being searched.
11. To make SEARCH FUNCTIONALITY work in every webpage, we move our SEARCH HTML CODE AND add this in the BASE.HTML
12. Run the server and search for a word like 'TOYOTA'
13. Add a SEARCH FUNCTIONALITY USING THE SEARCH FORM.
From the HOME.HTML, we remove this BRAND block
14. We need to search based on the existing MODEL, YEAR, LOCATION, Go to PAGES\VIEWS.PY and update HOME FUNCTION.
15. To display dynamic and current values for searching, update the HOME.HTML
FROM:
TO:
16. To remove the duplicates in the search drop - down box, modify the PAGES\VIEWS.PY home function,
FROM:
TO:
17. We make a LIST out of CARS query on extracting only UNIQUE VALUES OF MODEL, CITY, YEAR, BODY STYLE. We modify our HOME.HTML as:
No PDF file attached.