22 lines
629 B
Python
22 lines
629 B
Python
from django.db import models
|
|
from modelcluster.fields import ParentalKey
|
|
from wagtail.admin.panels import FieldPanel, InlinePanel
|
|
from wagtail.fields import RichTextField
|
|
from wagtail.models import Orderable, Page
|
|
|
|
|
|
class HomePage(Page):
|
|
body = RichTextField(blank=True)
|
|
|
|
content_panels = Page.content_panels + [
|
|
FieldPanel("body"),
|
|
InlinePanel("links"),
|
|
]
|
|
|
|
|
|
class HomePageLink(Orderable):
|
|
page = ParentalKey(HomePage, on_delete=models.CASCADE, related_name="links")
|
|
title = models.CharField(max_length=256)
|
|
link = models.URLField()
|
|
|
|
panels = [FieldPanel("title"), FieldPanel("link")]
|