From 2a485e499ecf2c371d5c33f9c8d7caf31b66075e Mon Sep 17 00:00:00 2001 From: Matt Westcott Date: Thu, 5 Feb 2015 11:22:17 +0000 Subject: [PATCH] define the default value of a StreamBlock to be an empty StreamValue, not a list --- wagtail/wagtailadmin/blocks.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/wagtail/wagtailadmin/blocks.py b/wagtail/wagtailadmin/blocks.py index 0a9b19824..48f89a28e 100644 --- a/wagtail/wagtailadmin/blocks.py +++ b/wagtail/wagtailadmin/blocks.py @@ -585,7 +585,12 @@ class ListBlock(Block): # =========== class BaseStreamBlock(Block): - default = [] + # TODO: decide what it means to pass a 'default' arg to StreamBlock's constructor. Logically we want it to be + # of type StreamValue, but we can't construct one of those because it needs a reference back to the StreamBlock + # that we haven't constructed yet... + @property + def default(self): + return StreamValue(self, []) def __init__(self, local_blocks=None, **kwargs): super(BaseStreamBlock, self).__init__(**kwargs)