Blog body is a stream field
This commit is contained in:
parent
dbd449b708
commit
f96124b744
9 changed files with 54 additions and 5 deletions
|
@ -5,12 +5,15 @@ from modelcluster.contrib.taggit import ClusterTaggableManager
|
|||
from taggit.models import TaggedItemBase
|
||||
|
||||
from wagtail.models import Page, Orderable
|
||||
from wagtail.fields import RichTextField
|
||||
from wagtail.fields import RichTextField, StreamField
|
||||
from wagtail.admin.panels import FieldPanel, InlinePanel, MultiFieldPanel
|
||||
from wagtail.search import index
|
||||
|
||||
from wagtail.snippets.models import register_snippet
|
||||
|
||||
from blog.blocks import BlogPostBlock
|
||||
|
||||
|
||||
class BlogIndexPage(Page):
|
||||
intro = RichTextField(blank=True)
|
||||
|
||||
|
@ -46,7 +49,12 @@ class BlogPageTag(TaggedItemBase):
|
|||
class BlogPage(Page):
|
||||
date = models.DateField("Post date")
|
||||
intro = models.CharField(max_length=250)
|
||||
body = RichTextField(blank=True)
|
||||
body = StreamField(
|
||||
BlogPostBlock(),
|
||||
blank=True,
|
||||
use_json_field=True,
|
||||
help_text="Write anything",
|
||||
)
|
||||
|
||||
authors = ParentalManyToManyField('blog.Author', blank=True)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue