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