make StreamField behave correctly for migrations

This commit is contained in:
Matt Westcott 2015-02-04 19:03:15 +00:00
parent 7f3c0f5af0
commit 0afb1a3b50
2 changed files with 6 additions and 0 deletions

View file

@ -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

View file

@ -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