Added stream field to all page models
This commit is contained in:
parent
0c4b6432d6
commit
7f9fe866f3
2 changed files with 8 additions and 8 deletions
|
@ -1,8 +1,7 @@
|
|||
from django.db import models
|
||||
|
||||
from project.common.fields import build_stream_field
|
||||
from wagtail.wagtailcore.models import Page
|
||||
from wagtail.wagtailcore.fields import RichTextField
|
||||
from wagtail.wagtailadmin.edit_handlers import FieldPanel
|
||||
from wagtail.wagtailadmin.edit_handlers import FieldPanel, StreamFieldPanel
|
||||
from wagtail.wagtailimages.edit_handlers import ImageChooserPanel
|
||||
from wagtail.wagtailsearch import index
|
||||
|
||||
|
@ -19,7 +18,7 @@ class BlogPage(Entity):
|
|||
)
|
||||
date = models.DateField("Post date")
|
||||
intro = models.CharField(max_length=250)
|
||||
body = RichTextField(blank=True)
|
||||
body = build_stream_field()
|
||||
|
||||
search_fields = Page.search_fields + [
|
||||
index.SearchField('intro'),
|
||||
|
@ -30,5 +29,5 @@ class BlogPage(Entity):
|
|||
FieldPanel('date'),
|
||||
ImageChooserPanel('main_image'),
|
||||
FieldPanel('intro'),
|
||||
FieldPanel('body'),
|
||||
StreamFieldPanel('body'),
|
||||
]
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
from django.db import models
|
||||
from project.common.fields import build_stream_field
|
||||
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
|
||||
from wagtail.wagtailadmin.edit_handlers import FieldPanel, StreamFieldPanel
|
||||
|
||||
|
||||
class SimpleContentPage(Entity):
|
||||
body = RichTextField()
|
||||
body = build_stream_field()
|
||||
|
||||
content_panels = Page.content_panels + [
|
||||
FieldPanel('body', classname="full")
|
||||
StreamFieldPanel('body')
|
||||
]
|
||||
|
||||
|
||||
|
|
Reference in a new issue