Add description to chapter

This commit is contained in:
Ramon Wenger 2018-10-03 18:48:31 +02:00
parent 551f20544a
commit e425122455
5 changed files with 28 additions and 1 deletions

View File

@ -2,6 +2,10 @@
<div class="chapter">
<h3>{{chapter.title}}</h3>
<p>
{{chapter.description}}
</p>
<add-content-block-button :parent="chapter.id"></add-content-block-button>
<content-block :contentBlock="contentBlock"

View File

@ -28,6 +28,7 @@ query ModulesQuery($slug: String!) {
node {
id
title
description
contentBlocks {
edges {
node {

View File

@ -0,0 +1,18 @@
# Generated by Django 2.0.6 on 2018-10-03 16:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('book', '0006_auto_20181002_1359'),
]
operations = [
migrations.AddField(
model_name='chapter',
name='description',
field=models.TextField(blank=True),
),
]

View File

@ -1,5 +1,6 @@
import logging
from django.db import models
from wagtail.admin.edit_handlers import FieldPanel, TabbedInterface, ObjectList
from core.wagtail_utils import StrictHierarchyPage
@ -12,8 +13,11 @@ class Chapter(StrictHierarchyPage):
verbose_name = 'Kapitel'
verbose_name_plural = 'Kapitel'
description = models.TextField(blank=True)
content_panels = [
FieldPanel('title', classname="full title"),
FieldPanel('description', classname="full description"),
]
settings_panels = [

View File

@ -24,7 +24,7 @@ class ChapterNode(DjangoObjectType):
class Meta:
model = Chapter
only_fields = [
'slug', 'title',
'slug', 'title', 'description',
]
filter_fields = [
'slug', 'title',