Add content list

This commit is contained in:
Christian Cueni 2019-07-11 11:38:47 +02:00
parent 780d72f3b9
commit fd4a9d2e18
1 changed files with 7 additions and 3 deletions

View File

@ -2,6 +2,7 @@ import logging
from django.db import models
from wagtail.admin.edit_handlers import FieldPanel, TabbedInterface, ObjectList, StreamFieldPanel
from wagtail.core.blocks import StreamBlock
from wagtail.core.fields import StreamField
from wagtail.images.blocks import ImageChooserBlock
@ -34,7 +35,7 @@ class ContentBlock(StrictHierarchyPage):
visible_for = models.ManyToManyField(SchoolClass, related_name='visible_content_blocks')
user_created = models.BooleanField(default=False)
contents = StreamField([
content_blocks = [
('text_block', TextBlock()),
('basic_knowledge', BasicKnowledgeBlock()),
('assignment', AssignmentBlock()),
@ -46,8 +47,11 @@ class ContentBlock(StrictHierarchyPage):
('document_block', DocumentBlock()),
('infogram_block', InfogramBlock()),
('genially_block', GeniallyBlock()),
('subtitle', SubtitleBlock()),
], null=True, blank=True)
('subtitle', SubtitleBlock())
]
content_list = StreamBlock(content_blocks)
contents = StreamField(content_blocks + [('content_list', content_list)], null=True, blank=True)
type = models.CharField(
max_length=100,