shy-zebra-22292
11/19/2022, 12:59 PMshy-zebra-22292
11/19/2022, 1:01 PMflaky-fish-46395
11/19/2022, 1:02 PMkind-kite-734
11/22/2022, 3:43 PMreturn HttpResponse(status=204, headers={"HX-Location": "/portfolio/overview/0182727d-547a-7d85-858e-bdfc7512ca6b"})
This doesn't:
return HttpResponse(status=204, headers={"HX-Location": {"path":"/portfolio/overview/0182727d-547a-7d85-858e-bdfc7512ca6b","target":"#details-container"}})
Even if I exclude the target and just put the path in the second bit of code, it doesn't work.
Thanks allkind-kite-734
11/22/2022, 3:58 PMtall-dinner-62086
11/22/2022, 4:02 PMkind-kite-734
11/22/2022, 5:11 PMtall-dinner-62086
11/22/2022, 5:12 PMtall-dinner-62086
11/22/2022, 5:14 PM"HX-Location": '{"path":"/.../", "target":"..."}'
kind-kite-734
11/22/2022, 5:32 PMtall-dinner-62086
11/22/2022, 5:34 PMripe-action-67367
11/22/2022, 8:01 PMancient-shoe-86801
11/22/2022, 9:10 PMhtmx-flask
, I created a helper to easily generate responses with htmx fields. I want the users to be able to pass a dict
or a string for the location header, and for that to work I had to do this:
python
def _stringify(val):
return val if isinstance(val, str) else json.dumps(val)
...
resp.headers["HX-Location"] = _stringify(location)
(where location
can be a string or a dict)ancient-shoe-86801
11/22/2022, 9:11 PMancient-shoe-86801
11/22/2022, 9:12 PMkind-kite-734
11/23/2022, 4:58 PMancient-shoe-86801
11/23/2022, 5:40 PMcrooked-winter-42525
11/28/2022, 3:17 PMcrooked-winter-42525
11/28/2022, 3:46 PMbitter-monkey-50309
11/28/2022, 4:58 PMoobBeforeSwap
event which you could listen for and delay https://htmx.org/events/#htmx:oobBeforeSwapcrooked-winter-42525
11/29/2022, 12:13 AMblue-ghost-19146
11/29/2022, 5:28 PMContent-Disposition
header. It seems that with htmx, I can swap in whatever content I want but the file download doesn't happen (expected), and without htmx the file download does occur but any other content I want to swap into the page obviously doesn't appear. Has anyone found a way of updating the current page and causing a file download using Django, or through any other relevant approaches?green-activity-6102
11/29/2022, 5:47 PMafterSwap
event to set something like window.location
to your download URL to start the downloadgreen-activity-6102
11/29/2022, 5:48 PMquiet-action-5563
12/01/2022, 12:40 PMmysterious-toddler-20573
12/01/2022, 12:48 PMmysterious-toddler-20573
12/01/2022, 12:53 PMmysterious-toddler-20573
12/01/2022, 12:53 PMquiet-action-5563
12/01/2022, 12:54 PMmysterious-toddler-20573
12/01/2022, 12:54 PM