Add server handling of content list items

This commit is contained in:
Ramon Wenger 2022-01-24 17:52:36 +01:00
parent a31c644553
commit b51d992546
2 changed files with 9 additions and 0 deletions

View File

@ -11,6 +11,7 @@ class InputTypes(graphene.Enum):
link_block = 'link_block'
video_block = 'video_block'
document_block = 'document_block'
content_list_item = 'content_list_item'
class ContentElementValueInput(InputObjectType):
@ -28,6 +29,7 @@ class ContentElementInput(InputObjectType):
id = graphene.String()
type = InputTypes(required=True)
value = ContentElementValueInput()
contents = graphene.List('books.schema.inputs.ContentElementInput')
class UserGroupBlockVisibility(InputObjectType):

View File

@ -34,6 +34,7 @@ ALLOWED_BLOCKS = (
'video_block',
'assignment',
'document_block',
'content_list_item'
)
@ -100,6 +101,12 @@ def handle_content_block(content, context=None, module=None, allowed_blocks=ALLO
'value': {
'url': bleach.clean(content['value']['url'])
}}
elif content['type'] == 'content_list_item':
return {
'type': 'content_list_item',
'value': [handle_content_block(c, context, module) for c in content['contents']]
}
return None