add association index and subpages
This commit is contained in:
@ -1,7 +1,13 @@
|
||||
from django.db import models
|
||||
from grapple.models import (
|
||||
GraphQLImage,
|
||||
GraphQLRichText,
|
||||
GraphQLStreamfield,
|
||||
GraphQLString,
|
||||
)
|
||||
from wagtail import blocks
|
||||
from wagtail.admin.panels import FieldPanel
|
||||
from wagtail.fields import StreamField
|
||||
from wagtail.fields import RichTextField, StreamField
|
||||
from wagtail.models import Page
|
||||
|
||||
|
||||
@ -9,6 +15,8 @@ class AssociationIndex(Page):
|
||||
max_count = 1
|
||||
subpage_types = ["associations.AssociationPage"]
|
||||
|
||||
lead = RichTextField(features=["bold", "italic", "link"])
|
||||
|
||||
body = StreamField(
|
||||
[
|
||||
("paragraph", blocks.RichTextBlock()),
|
||||
@ -16,7 +24,13 @@ class AssociationIndex(Page):
|
||||
)
|
||||
|
||||
content_panels = Page.content_panels + [
|
||||
FieldPanel("body"),
|
||||
FieldPanel("lead", heading="Leder"),
|
||||
FieldPanel("body", heading="Innhold"),
|
||||
]
|
||||
|
||||
graphql_fields = [
|
||||
GraphQLRichText("lead"),
|
||||
GraphQLStreamfield("body"),
|
||||
]
|
||||
|
||||
|
||||
@ -44,11 +58,18 @@ class AssociationPage(Page):
|
||||
on_delete=models.SET_NULL,
|
||||
related_name="+",
|
||||
)
|
||||
websiteUrl = models.URLField()
|
||||
website_url = models.URLField()
|
||||
|
||||
content_panels = Page.content_panels + [
|
||||
FieldPanel("body"),
|
||||
FieldPanel("logo"),
|
||||
FieldPanel("association_type", heading="Type"),
|
||||
FieldPanel("websiteUrl", heading="Nettside"),
|
||||
FieldPanel("website_url", heading="Nettside"),
|
||||
]
|
||||
|
||||
graphql_fields = [
|
||||
GraphQLStreamfield("body"),
|
||||
GraphQLImage("logo"),
|
||||
GraphQLString("website_url"),
|
||||
GraphQLString("association_type"),
|
||||
]
|
||||
|
Reference in New Issue
Block a user