add support for page sections on generic pages
This commit is contained in:
@ -1,20 +1,25 @@
|
||||
from grapple.models import GraphQLStreamfield
|
||||
from grapple.models import GraphQLRichText, GraphQLStreamfield
|
||||
from wagtail.admin.panels import FieldPanel
|
||||
from wagtail.fields import RichTextField, StreamField
|
||||
from wagtail.models import Page
|
||||
|
||||
from dnscms.fields import CommonStreamField
|
||||
from dnscms.blocks import PageSectionBlock
|
||||
from dnscms.fields import BASE_BLOCKS
|
||||
|
||||
|
||||
class GenericPage(Page):
|
||||
subpage_types = ["generic.GenericPage"]
|
||||
show_in_menus = True
|
||||
|
||||
body = CommonStreamField
|
||||
lead = RichTextField(features=["bold", "italic", "link"])
|
||||
body = StreamField(BASE_BLOCKS + [("page_section", PageSectionBlock(label="Seksjon"))])
|
||||
|
||||
content_panels = Page.content_panels + [
|
||||
FieldPanel("lead", heading="Leder"),
|
||||
FieldPanel("body", heading="Innhold"),
|
||||
]
|
||||
|
||||
graphql_fields = [
|
||||
GraphQLRichText("lead"),
|
||||
GraphQLStreamfield("body"),
|
||||
]
|
||||
|
Reference in New Issue
Block a user