wonderful-school-81222
12/12/2022, 10:22 PMpython
if hx_request:
return templates.TemplateResponse("account.html")
else:
return RedirectResponse("/")
mysterious-toddler-20573
12/12/2022, 10:25 PMHX-Request
and then I created a helper function for more elaborate situations where I wanted to select a particular template based on the exact path/target/etcmysterious-toddler-20573
12/12/2022, 10:25 PMwonderful-school-81222
12/12/2022, 10:27 PMorange-umbrella-16693
12/12/2022, 10:28 PMwonderful-school-81222
12/12/2022, 10:28 PMwonderful-school-81222
12/12/2022, 10:43 PMhtml
{% extends request.is_hxrequest|yesno:"base_ajax.html,base.html" %}
wonderful-school-81222
12/12/2022, 10:44 PMHX-Request
or not.wonderful-school-81222
12/12/2022, 10:44 PMbumpy-kangaroo-60192
12/12/2022, 11:02 PMbumpy-kangaroo-60192
12/12/2022, 11:03 PMwonderful-school-81222
12/12/2022, 11:08 PMbumpy-kangaroo-60192
12/12/2022, 11:11 PMwonderful-school-81222
12/12/2022, 11:18 PMancient-shoe-86801
12/12/2022, 11:25 PMrequest.htmx
, so you can do if request.htmx
ancient-shoe-86801
12/12/2022, 11:25 PMwonderful-school-81222
12/12/2022, 11:25 PMancient-shoe-86801
12/12/2022, 11:26 PMancient-shoe-86801
12/12/2022, 11:26 PMancient-shoe-86801
12/12/2022, 11:49 PMmysterious-toddler-20573
12/12/2022, 11:51 PMmysterious-toddler-20573
12/12/2022, 11:52 PMmysterious-toddler-20573
12/12/2022, 11:52 PMancient-shoe-86801
12/12/2022, 11:55 PMmysterious-toddler-20573
12/12/2022, 11:55 PMmysterious-toddler-20573
12/12/2022, 11:56 PMancient-shoe-86801
12/12/2022, 11:57 PMrefined-waiter-90422
12/13/2022, 12:42 AMhx-select="#page-content"
gorgeous-ghost-95789
12/13/2022, 12:42 AM