diff options
Diffstat (limited to 'home/models.py')
-rw-r--r-- | home/models.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/home/models.py b/home/models.py new file mode 100644 index 0000000..64acee0 --- /dev/null +++ b/home/models.py @@ -0,0 +1,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 + |