From 68b4aaa799462999c887d4f618d3d106f2af31f0 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Fri, 25 Nov 2016 20:23:02 +0000 Subject: [PATCH] create base model --- project/blog/models.py | 4 +++- project/common/models.py | 9 ++++++++- project/home/models.py | 6 ++++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/project/blog/models.py b/project/blog/models.py index 6ec2c80..31912d2 100644 --- a/project/blog/models.py +++ b/project/blog/models.py @@ -6,8 +6,10 @@ from wagtail.wagtailadmin.edit_handlers import FieldPanel from wagtail.wagtailimages.edit_handlers import ImageChooserPanel from wagtail.wagtailsearch import index +from project.common.models import Entity -class BlogPage(Page): + +class BlogPage(Entity): main_image = models.ForeignKey( 'wagtailimages.Image', null=True, diff --git a/project/common/models.py b/project/common/models.py index 3cca75b..a4bf64e 100644 --- a/project/common/models.py +++ b/project/common/models.py @@ -3,7 +3,14 @@ from wagtail.wagtailcore.fields import RichTextField from wagtail.wagtailadmin.edit_handlers import FieldPanel -class SectionIndexPage(Page): +class Entity(Page): + is_home = False + + class Meta: + abstract = True + + +class SectionIndexPage(Entity): intro = RichTextField(blank=True) content_panels = Page.content_panels + [ diff --git a/project/home/models.py b/project/home/models.py index 0143747..b4ad419 100755 --- a/project/home/models.py +++ b/project/home/models.py @@ -2,10 +2,12 @@ from wagtail.wagtailcore.models import Page from wagtail.wagtailcore.fields import RichTextField from wagtail.wagtailadmin.edit_handlers import FieldPanel +from project.common.models import Entity -class HomePage(Page): + +class HomePage(Entity): is_home = True - + body = RichTextField(blank=True) content_panels = Page.content_panels + [