add skeleton for dnscms
This commit is contained in:
42
dnscms/associations/models.py
Normal file
42
dnscms/associations/models.py
Normal file
@ -0,0 +1,42 @@
|
||||
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
|
||||
|
||||
|
||||
class Association(Page):
|
||||
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(
|
||||
max_length=64, choices=AssociationType, default=AssociationType.FORENING
|
||||
)
|
||||
logo = models.ForeignKey(
|
||||
"wagtailimages.Image",
|
||||
null=True,
|
||||
blank=True,
|
||||
on_delete=models.SET_NULL,
|
||||
related_name="+",
|
||||
)
|
||||
url = models.URLField()
|
||||
|
||||
content_panels = Page.content_panels + [
|
||||
# FieldPanel('author'),
|
||||
# FieldPanel('date'),
|
||||
FieldPanel("body"),
|
||||
FieldPanel("logo"),
|
||||
FieldPanel("association_type"),
|
||||
FieldPanel("url"),
|
||||
]
|
Reference in New Issue
Block a user