2016-12-09 05:11:31 +00:00
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
from django.db import models
|
|
|
|
|
|
|
|
from wagtail.wagtailcore.models import Page
|
2016-12-09 05:54:14 +00:00
|
|
|
from wagtail.wagtailcore.fields import StreamField
|
|
|
|
from wagtail.wagtailcore import blocks
|
|
|
|
from wagtail.wagtailadmin.edit_handlers import FieldPanel, StreamFieldPanel
|
|
|
|
from wagtail.wagtailimages.blocks import ImageChooserBlock
|
|
|
|
from wagtail.wagtailsearch import index
|
2016-12-09 05:11:31 +00:00
|
|
|
|
2016-12-09 05:54:14 +00:00
|
|
|
from .util import TranslatedField
|
2016-12-09 05:11:31 +00:00
|
|
|
|
|
|
|
class HomePage(Page):
|
2016-12-09 05:54:14 +00:00
|
|
|
title_fr = models.CharField(max_length=255, default="")
|
|
|
|
|
|
|
|
body_de = StreamField([
|
|
|
|
('heading', blocks.CharBlock(classname="full title")),
|
|
|
|
('paragraph', blocks.RichTextBlock()),
|
|
|
|
('image', ImageChooserBlock()),
|
|
|
|
], null=True, blank=True)
|
|
|
|
body_fr = StreamField([
|
|
|
|
('heading', blocks.CharBlock(classname="full title")),
|
|
|
|
('paragraph', blocks.RichTextBlock()),
|
|
|
|
('image', ImageChooserBlock()),
|
|
|
|
], null=True, blank=True)
|
|
|
|
|
|
|
|
translated_title = TranslatedField(
|
|
|
|
'title',
|
|
|
|
'title_fr',
|
|
|
|
)
|
|
|
|
body = TranslatedField(
|
|
|
|
'body_de',
|
|
|
|
'body_fr',
|
|
|
|
)
|
|
|
|
|
|
|
|
search_fields = Page.search_fields + [
|
|
|
|
index.SearchField('body_de'),
|
|
|
|
index.SearchField('body_fr'),
|
|
|
|
]
|
|
|
|
content_panels = Page.content_panels + [
|
2016-12-09 06:08:34 +00:00
|
|
|
FieldPanel('title_fr'),
|
2016-12-09 05:54:14 +00:00
|
|
|
StreamFieldPanel('body_de'),
|
|
|
|
StreamFieldPanel('body_fr'),
|
|
|
|
]
|