Merge branch 'feature/streamfield' of github.com:torchbox/wagtail into feature/streamfield

This commit is contained in:
Dave Cranwell 2015-02-11 14:10:48 +00:00
commit cfd9509b71
2 changed files with 3 additions and 2 deletions

View file

@ -541,7 +541,8 @@ class StructBlock(six.with_metaclass(DeclarativeSubBlocksMetaclass, BaseStructBl
class ListBlock(Block):
class Meta:
default = []
# Default to a list consisting of one empty child item (using None to trigger the child's empty / default rendering)
default = [None]
def __init__(self, child_block, **kwargs):
super(ListBlock, self).__init__(**kwargs)

View file

@ -55,7 +55,7 @@ class StreamField(with_metaclass(models.SubfieldBase, models.Field)):
return name, path, args, kwargs
def to_python(self, value):
if value is None:
if value is None or value == '':
return StreamValue(self.stream_block, [])
elif isinstance(value, StreamValue):
return value