First of all, thank you @davish for sharing your code 🤗
I made a bunch of small modifications bundled in a single PR (sorry if it's messy).
I wrote a helper function: render_turbo(). That can be used when answering a form submit. If the request comes from trubo, it sends a turbo frame with the correct headers. Otherwise, it it comes from a plain request, it sends a 303 redirect
I also ensured that the demo is still working even when the JS is deactivated by including the form directly on the detail view but also in the /send view.
And some small details:
I removed some superfluous tags and attributes: data-turbo-frame="messages" in the form as well as an extra <turbo-frame id="messages-frame"> that did nothing
I hacked sys.path in the experiment chat app so it can import turbo that is in the parent directory (i guess we'll do something prettier when we have a pip installable package)
I removed turbo/migrations/__init__.py and turbo/tests.py because they are empty at the moment
Hi 👋
First of all, thank you @davish for sharing your code 🤗
I made a bunch of small modifications bundled in a single PR (sorry if it's messy).
I wrote a helper function:
render_turbo()
. That can be used when answering a form submit. If the request comes from trubo, it sends a turbo frame with the correct headers. Otherwise, it it comes from a plain request, it sends a 303 redirectI also ensured that the demo is still working even when the JS is deactivated by including the form directly on the detail view but also in the /send view.
And some small details:
data-turbo-frame="messages"
in the form as well as an extra<turbo-frame id="messages-frame">
that did nothingsys.path
in the experiment chat app so it can importturbo
that is in the parent directory (i guess we'll do something prettier when we have a pip installable package)turbo/migrations/__init__.py
andturbo/tests.py
because they are empty at the moment