From 151a386ff597b27906f873cba781d2d42d95d5bc Mon Sep 17 00:00:00 2001 From: Matt Westcott Date: Wed, 30 Aug 2023 14:57:35 +0100 Subject: [PATCH] Add note to clarify that blocks are not interchangeable with model fields Prompted by https://stackoverflow.com/questions/76973112/unknown-fields-specified-for-a-page-model-in-wagtail-at-content-panels/76973226?noredirect=1#comment135693718_76973226 and similar misconceptions people have made in the past. --- docs/reference/streamfield/blocks.md | 4 ++++ docs/topics/streamfield.md | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/docs/reference/streamfield/blocks.md b/docs/reference/streamfield/blocks.md index f1f007b4f4..5f0646ea58 100644 --- a/docs/reference/streamfield/blocks.md +++ b/docs/reference/streamfield/blocks.md @@ -4,6 +4,10 @@ This document details the block types provided by Wagtail for use in [StreamField](streamfield), and how they can be combined into new block types. +```{note} + While block definitions look similar to model fields, they are not the same thing. Blocks are only valid within a StreamField - using them in place of a model field will not work. +``` + ```{eval-rst} .. class:: wagtail.fields.StreamField(blocks, use_json_field=None, blank=False, min_num=None, max_num=None, block_counts=None, collapsed=False) diff --git a/docs/topics/streamfield.md b/docs/topics/streamfield.md index 98b8769cf9..2284b00c0f 100644 --- a/docs/topics/streamfield.md +++ b/docs/topics/streamfield.md @@ -45,6 +45,11 @@ You can find the complete list of available block types in the [](streamfield_bl StreamField is not a direct replacement for other field types such as RichTextField. If you need to migrate an existing field to StreamField, refer to [](streamfield_migrating_richtext). ``` +```{note} + While block definitions look similar to model fields, they are not the same thing. Blocks are only valid within a StreamField - using them in place of a model field will not work. +``` + + (streamfield_template_rendering)= ## Template rendering