from django.db import models from wagtail.admin.edit_handlers import FieldPanel, StreamFieldPanel from wagtail.core.fields import StreamField from wagtail.images.blocks import ImageChooserBlock from books.blocks import LinkBlock, VideoBlock, DocumentBlock, SectionTitleBlock, InfogramBlock, \ GeniallyBlock, InstrumentTextBlock from core.wagtail_utils import StrictHierarchyPage class BasicKnowledge(StrictHierarchyPage): parent_page_types = ['books.book'] contents = StreamField([ ('text_block', InstrumentTextBlock()), ('image_block', ImageChooserBlock()), ('link_block', LinkBlock()), ('video_block', VideoBlock()), ('document_block', DocumentBlock()), ('section_title', SectionTitleBlock()), ('infogram_block', InfogramBlock()), ('genially_block', GeniallyBlock()), ], null=True, blank=True) LANGUAGE_COMMUNICATION = 'language_communication' SOCIETY = 'society' TYPE_CHOICES = ( (LANGUAGE_COMMUNICATION, 'Sprache & Kommunikation'), (SOCIETY, 'Gesellschaft'), ) type = models.CharField( max_length=100, choices=TYPE_CHOICES ) content_panels = [ FieldPanel('title', classname="full title"), FieldPanel('type'), StreamFieldPanel('contents') ]