summaryrefslogtreecommitdiff
path: root/home/models.py
blob: 64acee0fcb2508a843c04a45d1401bcf43ac4216 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from django.db import models
from django.utils.translation import ugettext_lazy as _

from wagtail.core.models import Page
from wagtail.core.fields import RichTextField
from wagtail.admin.edit_handlers import FieldPanel
from wagtail.images.edit_handlers import ImageChooserPanel


class BasePage(Page):
    image = models.ForeignKey(
        'wagtailimages.Image', on_delete=models.SET_NULL, related_name='+',
        help_text=_(
            "For top page: full width image. For child page: vignette."
        ), blank=True, null=True
    )
    body = RichTextField(blank=True)

    content_panels = Page.content_panels + [
        ImageChooserPanel('image'),
        FieldPanel('body', classname="full"),
    ]

    class Meta:
        abstract = True


class HomePage(BasePage):
    pass