Add 'allowed blocks' property for room entry
This commit is contained in:
parent
fb5b77e7f2
commit
9a89fa874b
|
|
@ -18,12 +18,25 @@ def newlines_to_paragraphs(text):
|
|||
return '\n'.join(paragraphs)
|
||||
|
||||
|
||||
def handle_content_blocks(content_data):
|
||||
ALLOWED_BLOCKS = (
|
||||
'text_block',
|
||||
'student_entry',
|
||||
'image_url_block',
|
||||
'link_block',
|
||||
'video_block',
|
||||
'document_block',
|
||||
)
|
||||
|
||||
|
||||
def handle_content_blocks(content_data, allowed_blocks=ALLOWED_BLOCKS):
|
||||
new_contents = []
|
||||
|
||||
for content in content_data:
|
||||
# todo: add all the content blocks
|
||||
# todo: sanitize user inputs!
|
||||
if content['type'] not in allowed_blocks:
|
||||
continue
|
||||
|
||||
if content['type'] == 'text_block':
|
||||
new_contents.append({
|
||||
'type': 'text_block',
|
||||
|
|
|
|||
Loading…
Reference in New Issue