Remove content blocks belonging to snapshots from CMS explorer
This commit is contained in:
parent
3c6160a7bb
commit
d09844a67b
|
|
@ -1,11 +1,10 @@
|
|||
from wagtail.core import hooks
|
||||
|
||||
from .models import ContentBlock
|
||||
from .models import ContentBlockSnapshot
|
||||
|
||||
|
||||
@hooks.register('construct_explorer_page_queryset')
|
||||
def remove_user_created_content_blocks_from_menu(parent_page, pages, request):
|
||||
if parent_page.content_type.model == 'chapter':
|
||||
content_block_ids = ContentBlock.get_by_parent(parent_page.specific).exclude(user_created=True).values_list('id', flat=True)
|
||||
return pages.filter(id__in=content_block_ids)
|
||||
return pages.not_type(ContentBlockSnapshot).exclude(contentblock__user_created=True)
|
||||
return pages
|
||||
|
|
|
|||
Loading…
Reference in New Issue