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