mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-17 19:51:11 +00:00
make StreamField behave correctly for migrations
This commit is contained in:
parent
7f3c0f5af0
commit
0afb1a3b50
2 changed files with 6 additions and 0 deletions
|
|
@ -720,6 +720,9 @@ class BaseStreamBlock(Block):
|
|||
])
|
||||
|
||||
def get_prep_value(self, value):
|
||||
if value is None:
|
||||
return None
|
||||
|
||||
return [
|
||||
{'type': bound_block.block.name, 'value': bound_block.block.get_prep_value(bound_block.value)}
|
||||
for bound_block in value.bound_blocks
|
||||
|
|
|
|||
|
|
@ -46,6 +46,9 @@ class StreamField(with_metaclass(models.SubfieldBase, models.Field)):
|
|||
self.stream_block = StreamBlock(block_types)
|
||||
super(StreamField, self).__init__(**kwargs)
|
||||
|
||||
def get_internal_type(self):
|
||||
return 'TextField'
|
||||
|
||||
def deconstruct(self):
|
||||
name, path, args, kwargs = super(StreamField, self).deconstruct()
|
||||
kwargs['block_types'] = self.block_types
|
||||
|
|
|
|||
Loading…
Reference in a new issue