From 589dc54836c260955d8c78b92abb60e448945aa6 Mon Sep 17 00:00:00 2001 From: Michaelyin Date: Thu, 1 Aug 2024 17:36:25 +0800 Subject: [PATCH] update doc --- docs/source/turbo_stream.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/source/turbo_stream.md b/docs/source/turbo_stream.md index b1329bb..b76789f 100644 --- a/docs/source/turbo_stream.md +++ b/docs/source/turbo_stream.md @@ -81,6 +81,22 @@ return turbo_stream.response([ ]) ``` +## Morph Method + +As for `update` and `replace` actions, we can set `[method="morph"]` to make it work. + +```python +turbo_stream.update("target", content="some html", method="morph") +``` + +In Django template: + +```html +{% load turbo_helper %} + +{% turbo_stream "update" "target" method="morph" %}some html{% endturbo_stream %} +``` + ## Render from Django Template `turbo_stream` can help us generate `turbo-stream` element in Django template.