浏览代码

Revert "Simplify example of appending a rich text block to a streamfield" (#12831)

See #12827 - `normalize` is not applied on append, so the value type must match.

This reverts commit b0cda80626e3a1af7f24b37be76eda1de24250ca.
Matt Westcott 1 月之前
父节点
当前提交
335817e289
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      docs/topics/streamfield.md

+ 2 - 1
docs/topics/streamfield.md

@@ -588,7 +588,8 @@ my_page.body[0] = ('heading', "My story")
 del my_page.body[-1]
 
 # Append a rich text block to the stream
-my_page.body.append(('paragraph', "<p>And they all lived happily ever after.</p>"))
+from wagtail.rich_text import RichText
+my_page.body.append(('paragraph', RichText("<p>And they all lived happily ever after.</p>")))
 
 # Save the updated data back to the database
 my_page.save()