blog2.0/blog/home/models.py
2024-06-14 14:57:03 +02:00

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")]