Add server handling of content list items
This commit is contained in:
parent
a31c644553
commit
b51d992546
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue