0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-12-01 11:41:20 +01:00

fixup! Add form data helpers

This commit is contained in:
Matt Westcott 2018-02-15 10:39:27 +00:00
parent bed10c31cb
commit 7a15996d60
2 changed files with 4 additions and 4 deletions

View File

@ -212,11 +212,11 @@ class TestFormDataHelpers(TestCase):
'content-count': '2',
'content-0-type': 'text',
'content-0-value': 'Hello, world',
'content-0-order': 0,
'content-0-order': '0',
'content-0-deleted': '',
'content-1-type': 'text',
'content-1-value': 'Goodbye, world',
'content-1-order': 1,
'content-1-order': '1',
'content-1-deleted': '',
}
)

View File

@ -58,13 +58,13 @@ def streamfield(items):
# 'content-count': '1',
# 'content-0-type': 'text',
# 'content-0-value': 'Hello, world',
# 'content-0-order': 0,
# 'content-0-order': '0',
# 'content-0-deleted': '',
# }
"""
def to_block(index, item):
block, value = item
return {'type': block, 'value': value, 'deleted': '', 'order': index}
return {'type': block, 'value': value, 'deleted': '', 'order': str(index)}
data_dict = {str(index): to_block(index, item)
for index, item in enumerate(items)}
data_dict['count'] = str(len(data_dict))