contact@digitalnotebooks.co
Stay Organized, Stay Inspired. Let's Write.

Car Listing: Search Functionality Part 10

Back To All Notes
  • Notebook: Django Project: Car Listing
  • Speaker: Udemy Instructor Rathan Kumar
  • Date Created: July 18, 2024, 12:14 a.m.
  • Owner: Rosilie

1. To allow searching based on other fields like MODEL, YEAR, CITY, or BODY_STYLE, update the SEARCH function in CARS\VIEWS.PY

FROM:

TO:

2. We change the name of our SELECT attributes 

FROM:

TO:

3. For the PRICE SLIDER. We use GTE (FOR GREATER THAN OR EQUAL) and LTE (FOR LESS THAN EQUAL)

* take note of the double underscore before the use of LTE or GTE ( __gte or __lte)

Run the server again to search using the price slider:

Result should be:

4. We do the same for the SEARCH functionality on the CARS web page. We copy the code from HOME.HTML search functionality into CARS.HTML.

We replace this block with the search block from the HOME.HTML

New code:

5. Update the CARS\VIEWS.PY by copying the search code we did on our home page.

We copy what we did from the PAGES\VIEWS.PY for HOME.HTML search function.

from PAGES\VIEWS.PY

6. We complete the TOP SEARCH  functionality

We remove unwanted fields like BRAND. Go to SEARCH.HTML and replace the name:

FROM:

TO:

7. We update the SEARCH function in the  CARS\VIEWS.PY

8. Run the server.

 

 



No PDF file attached.

Notebook
Notebook Details
Title: Django Project: Car Listing
Category: Udemy Django Course