add event organizer models, changes to associations
This commit is contained in:
@ -1,23 +1,37 @@
|
||||
from django.db import models
|
||||
|
||||
|
||||
from wagtail.models import Page
|
||||
from wagtail.fields import StreamField
|
||||
from wagtail import blocks
|
||||
from wagtail.admin.panels import FieldPanel
|
||||
from wagtail.images.blocks import ImageChooserBlock
|
||||
from wagtail.fields import StreamField
|
||||
from wagtail.models import Page
|
||||
|
||||
|
||||
class Association(Page):
|
||||
class AssociationIndex(Page):
|
||||
max_count = 1
|
||||
subpage_types = ["associations.AssociationPage"]
|
||||
|
||||
body = StreamField(
|
||||
[
|
||||
("paragraph", blocks.RichTextBlock()),
|
||||
]
|
||||
)
|
||||
|
||||
content_panels = Page.content_panels + [
|
||||
FieldPanel("body"),
|
||||
]
|
||||
|
||||
|
||||
class AssociationPage(Page):
|
||||
subpage_types = []
|
||||
parent_page_types = ["associations.AssociationIndex"]
|
||||
show_in_menus = False
|
||||
|
||||
class AssociationType(models.TextChoices):
|
||||
FORENING = "forening", "Forening"
|
||||
UTVALG = "utvalg", "Utvalg"
|
||||
|
||||
body = StreamField(
|
||||
[
|
||||
("heading", blocks.CharBlock(form_classname="title")),
|
||||
("paragraph", blocks.RichTextBlock()),
|
||||
("image", ImageChooserBlock()),
|
||||
]
|
||||
)
|
||||
association_type = models.CharField(
|
||||
@ -30,13 +44,11 @@ class Association(Page):
|
||||
on_delete=models.SET_NULL,
|
||||
related_name="+",
|
||||
)
|
||||
url = models.URLField()
|
||||
websiteUrl = models.URLField()
|
||||
|
||||
content_panels = Page.content_panels + [
|
||||
# FieldPanel('author'),
|
||||
# FieldPanel('date'),
|
||||
FieldPanel("body"),
|
||||
FieldPanel("logo"),
|
||||
FieldPanel("association_type"),
|
||||
FieldPanel("url"),
|
||||
FieldPanel("association_type", heading="Type"),
|
||||
FieldPanel("websiteUrl", heading="Nettside"),
|
||||
]
|
||||
|
Reference in New Issue
Block a user