mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-12 17:23:15 +00:00
Merge branch 'feature/streamfield' of github.com:torchbox/wagtail into feature/streamfield
This commit is contained in:
commit
cfd9509b71
2 changed files with 3 additions and 2 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue