From 3c496cd951bf6db29974097aa3f8ad6f2b59a875 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Mon, 28 Nov 2016 21:36:11 +0000 Subject: [PATCH] move pages from common to seperate app --- project/common/models.py | 11 ---------- project/pages/__init__.py | 0 .../migrations/0001_initial.py | 13 ++++++++++- project/pages/migrations/__init__.py | 0 project/pages/models.py | 22 +++++++++++++++++++ project/settings.py | 1 + 6 files changed, 35 insertions(+), 12 deletions(-) create mode 100644 project/pages/__init__.py rename project/{common => pages}/migrations/0001_initial.py (63%) create mode 100644 project/pages/migrations/__init__.py create mode 100644 project/pages/models.py diff --git a/project/common/models.py b/project/common/models.py index 7d118dc..d5859f4 100644 --- a/project/common/models.py +++ b/project/common/models.py @@ -1,7 +1,4 @@ -from django.db import models from wagtail.wagtailcore.models import Page -from wagtail.wagtailcore.fields import RichTextField -from wagtail.wagtailadmin.edit_handlers import FieldPanel class Entity(Page): @@ -11,11 +8,3 @@ class Entity(Page): abstract = True -class SectionIndexPage(Entity): - intro = RichTextField(blank=True) - hide_list = models.BooleanField(default=False) - - content_panels = Page.content_panels + [ - FieldPanel('intro', classname="full"), - FieldPanel('hide_list') - ] diff --git a/project/pages/__init__.py b/project/pages/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/project/common/migrations/0001_initial.py b/project/pages/migrations/0001_initial.py similarity index 63% rename from project/common/migrations/0001_initial.py rename to project/pages/migrations/0001_initial.py index 4142a0e..ffbad40 100644 --- a/project/common/migrations/0001_initial.py +++ b/project/pages/migrations/0001_initial.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Generated by Django 1.10.3 on 2016-11-28 18:43 +# Generated by Django 1.10.3 on 2016-11-28 21:29 from __future__ import unicode_literals from django.db import migrations, models @@ -28,4 +28,15 @@ class Migration(migrations.Migration): }, bases=('wagtailcore.page',), ), + migrations.CreateModel( + name='SimpleContentPage', + fields=[ + ('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')), + ('body', wagtail.wagtailcore.fields.RichTextField()), + ], + options={ + 'abstract': False, + }, + bases=('wagtailcore.page',), + ), ] diff --git a/project/pages/migrations/__init__.py b/project/pages/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/project/pages/models.py b/project/pages/models.py new file mode 100644 index 0000000..a9892ae --- /dev/null +++ b/project/pages/models.py @@ -0,0 +1,22 @@ +from django.db import models +from project.common.models import Entity +from wagtail.wagtailcore.models import Page +from wagtail.wagtailcore.fields import RichTextField +from wagtail.wagtailadmin.edit_handlers import FieldPanel + + +class SimpleContentPage(Entity): + body = RichTextField() + + content_panels = Page.content_panels + [ + FieldPanel('body', classname="full") + ] + +class SectionIndexPage(Entity): + intro = RichTextField(blank=True) + hide_list = models.BooleanField(default=False) + + content_panels = Page.content_panels + [ + FieldPanel('intro', classname="full"), + FieldPanel('hide_list') + ] diff --git a/project/settings.py b/project/settings.py index 7af97a3..3b369fa 100755 --- a/project/settings.py +++ b/project/settings.py @@ -44,6 +44,7 @@ INSTALLED_APPS = [ 'project.blog', 'project.common', 'project.home', + 'project.pages', 'project.projects', 'project.search', ]