Change to content to Orderable
This commit is contained in:
@@ -2,62 +2,45 @@ from __future__ import unicode_literals
|
||||
|
||||
from django.db import models
|
||||
|
||||
from wagtail.models import Page
|
||||
from wagtail.models import Page, Orderable
|
||||
from wagtail.fields import RichTextField
|
||||
from wagtail.admin.panels import FieldPanel, MultiFieldPanel
|
||||
from wagtail.admin.panels import FieldPanel, MultiFieldPanel, InlinePanel
|
||||
from modelcluster.models import ParentalKey
|
||||
|
||||
from saburly.custom_editor import FULL_EDITOR
|
||||
|
||||
class HomePage(Page):
|
||||
intro_title = RichTextField(blank=True, features=FULL_EDITOR)
|
||||
intro_text = RichTextField(blank=True, features=FULL_EDITOR)
|
||||
intro_image = RichTextField(blank=True, features=FULL_EDITOR)
|
||||
|
||||
section_one_title = RichTextField(blank=True, features=FULL_EDITOR)
|
||||
section_one_text = RichTextField(blank=True, features=FULL_EDITOR)
|
||||
section_one_img = RichTextField(blank=True, features=FULL_EDITOR)
|
||||
|
||||
section_two_title = RichTextField(blank=True, features=FULL_EDITOR)
|
||||
section_two_text = RichTextField(blank=True, features=FULL_EDITOR)
|
||||
section_two_img = RichTextField(blank=True, features=FULL_EDITOR)
|
||||
|
||||
section_three_title = RichTextField(blank=True, features=FULL_EDITOR)
|
||||
section_three_text = RichTextField(blank=True, features=FULL_EDITOR)
|
||||
section_three_img = RichTextField(blank=True, features=FULL_EDITOR)
|
||||
|
||||
section_four_title = RichTextField(blank=True, features=FULL_EDITOR)
|
||||
section_four_text = RichTextField(blank=True, features=FULL_EDITOR)
|
||||
section_four_img = RichTextField(blank=True, features=FULL_EDITOR)
|
||||
|
||||
section_five_title = RichTextField(blank=True, features=FULL_EDITOR)
|
||||
section_five_text = RichTextField(blank=True, features=FULL_EDITOR)
|
||||
section_five_img = RichTextField(blank=True, features=FULL_EDITOR)
|
||||
|
||||
content_panels = Page.content_panels + [
|
||||
MultiFieldPanel([
|
||||
FieldPanel('section_one_title', classname="full"),
|
||||
FieldPanel('section_one_text', classname="full"),
|
||||
FieldPanel('section_one_img', classname="full"),
|
||||
], heading="Section One"),
|
||||
FieldPanel('intro_title', classname="full"),
|
||||
FieldPanel('intro_text', classname="full"),
|
||||
FieldPanel('intro_image', classname="full"),
|
||||
], heading="Intro Section"),
|
||||
InlinePanel('homepage_sections', heading="Sections Home", label="Sections Home"),
|
||||
|
||||
MultiFieldPanel([
|
||||
FieldPanel('section_two_title', classname="full"),
|
||||
FieldPanel('section_two_text', classname="full"),
|
||||
FieldPanel('section_two_img', classname="full"),
|
||||
], heading="Section Two"),
|
||||
|
||||
MultiFieldPanel([
|
||||
FieldPanel('section_three_title', classname="full"),
|
||||
FieldPanel('section_three_text', classname="full"),
|
||||
FieldPanel('section_three_img', classname="full"),
|
||||
], heading="Section Three"),
|
||||
|
||||
MultiFieldPanel([
|
||||
FieldPanel('section_four_title', classname="full"),
|
||||
FieldPanel('section_four_text', classname="full"),
|
||||
FieldPanel('section_four_img', classname="full"),
|
||||
], heading="Section Four"),
|
||||
|
||||
MultiFieldPanel([
|
||||
FieldPanel('section_five_title', classname="full"),
|
||||
FieldPanel('section_five_text', classname="full"),
|
||||
FieldPanel('section_five_img', classname="full"),
|
||||
], heading="Section Five"),
|
||||
]
|
||||
|
||||
|
||||
class HomePageSections(Orderable):
|
||||
page = ParentalKey(HomePage, on_delete=models.CASCADE, related_name='homepage_sections')
|
||||
|
||||
section_title = RichTextField(blank=True, features=FULL_EDITOR)
|
||||
section_text = RichTextField(blank=True, features=FULL_EDITOR)
|
||||
section_image = models.ForeignKey(
|
||||
'wagtailimages.Image',
|
||||
null=True,
|
||||
blank=True,
|
||||
on_delete=models.SET_NULL,
|
||||
related_name='+'
|
||||
)
|
||||
|
||||
panels = [
|
||||
FieldPanel('section_title'),
|
||||
FieldPanel('section_text'),
|
||||
FieldPanel('section_image'),
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user