https://htmx.org logo
<@594916788408418304> I don't know with Django, bu...
# 🔥-django-htmx
a
@kind-kite-734 I don't know with Django, but when building
htmx-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:
Copy code
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)