File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed
Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -530,8 +530,8 @@ def show_contacts(contacts: list[dict]):
530530 return [Tr(*[Td(contact[col]) for col in keys]) for contact in contacts]
531531
532532# POST request to handle search
533- @rt("/search")
534- def post (search: str = None):
533+ @rt
534+ def search (search: str = None):
535535 # Default search term is empty string, which shows all contacts
536536 # If a search term is provided, it is converted to lowercase
537537 search_term = search.lower() if search else ""
@@ -548,7 +548,6 @@ def post(search: str = None):
548548def index():
549549 return Titled("Active Search",
550550 Div(
551-
552551 H3("Search Contacts"),
553552 # HTMX for searching contacts
554553 Input(
@@ -559,7 +558,7 @@ def index():
559558 # Input is of a form type
560559 class_="form-control",
561560 # A POST request to '/search' is called when the user types
562- hx_post="/ search" ,
561+ post= search,
563562 # Search is delayed by 500ms to delay the search until the user has stopped typing
564563 # 'changed' is to ensure that no new search are triggered when the
565564 # user doesn't change the input of pastes the same value.
You can’t perform that action at this time.
0 commit comments