Fix bug get bookmarks
This commit is contained in:
parent
1ae8de894b
commit
861db768cd
|
|
@ -50,16 +50,17 @@ def find_content(content_list, bookmark):
|
|||
if content['type'] in ['text_block', 'subtitle', 'solution']:
|
||||
return content['value'].get('text', '')
|
||||
if content['type'] in ['basic_knowledge']:
|
||||
description = content['value'].get('description', '')
|
||||
if not description:
|
||||
try:
|
||||
return BasicKnowledge.objects.get(pk=content['value']['basic_knowledge']).title
|
||||
except BasicKnowledge.DoesNotExist:
|
||||
return ''
|
||||
if type(content['value']) is dict:
|
||||
description = content['value'].get('description', '')
|
||||
if not description:
|
||||
try:
|
||||
return BasicKnowledge.objects.get(pk=content['value']['basic_knowledge']).title
|
||||
except BasicKnowledge.DoesNotExist:
|
||||
return ''
|
||||
else:
|
||||
return description
|
||||
else:
|
||||
return description
|
||||
print(bookmark.uuid)
|
||||
print(json.dumps(content_dict, indent=4))
|
||||
logger.warn(f"Content value is not a dict: {content['value']}")
|
||||
return content_dict.get(content['type'], '')
|
||||
|
||||
class NoteNode(DjangoObjectType):
|
||||
|
|
|
|||
Loading…
Reference in New Issue