Skip to content

Commit

Permalink
Merge pull request #75 from molgen/add-sidebar-to-news
Browse files Browse the repository at this point in the history
Add sidebar to news
  • Loading branch information
donald authored Mar 3, 2020
2 parents 2a1dee5 + 29e1d37 commit 70da5ad
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
21 changes: 21 additions & 0 deletions mpicms/news/migrations/0022_newsentry_sidebar.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Generated by Django 2.2.9 on 2020-03-03 11:10

from django.db import migrations
import wagtail.core.blocks
import wagtail.core.fields
import wagtail.snippets.blocks


class Migration(migrations.Migration):

dependencies = [
('news', '0021_auto_20200119_1857'),
]

operations = [
migrations.AddField(
model_name='newsentry',
name='sidebar',
field=wagtail.core.fields.StreamField([('editor', wagtail.core.blocks.RichTextBlock(features=['h4', 'h5', 'h6', 'bold', 'italic', 'link', 'document-link'], label='Editor')), ('contacts', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock([('contact', wagtail.snippets.blocks.SnippetChooserBlock('personal.Contact', label='Contact')), ('information', wagtail.core.blocks.TextBlock(label='Information', required=False))]), icon='user', label='Contacts', template='base/blocks/contact_list_block.html'))], blank=True, verbose_name='Sidebar Content'),
),
]
6 changes: 3 additions & 3 deletions mpicms/news/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from wagtail.admin.edit_handlers import FieldPanel

from mpicms.base.models import CategoryMixin
from mpicms.base.mixins import BasePage, BodyMixin
from mpicms.base.mixins import BasePage, BodyMixin, SideBarMixin


class NewsPage(CategoryMixin, BasePage):
Expand Down Expand Up @@ -59,7 +59,7 @@ class Meta: # noqa
verbose_name_plural = _("news blogs")


class NewsEntry(CategoryMixin, BodyMixin, BasePage):
class NewsEntry(CategoryMixin, SideBarMixin, BodyMixin, BasePage):
date = models.DateField(_("date"), default=date.today)
header_image = models.ForeignKey(
'wagtailimages.Image',
Expand All @@ -75,7 +75,7 @@ class NewsEntry(CategoryMixin, BodyMixin, BasePage):
content_panels = Page.content_panels + BodyMixin.content_panels + [
FieldPanel('date'),
ImageChooserPanel('header_image'),
]
] + SideBarMixin.content_panels

promote_panels = Page.promote_panels + BodyMixin.promote_panels + [
FieldPanel('show_in_main_news')
Expand Down

0 comments on commit 70da5ad

Please sign in to comment.