From 12ab948ce3d383db9f9e56521aabdeb2e924f96c Mon Sep 17 00:00:00 2001 From: Fredrik Jonsson <frjo@xdeb.org> Date: Wed, 27 Mar 2019 09:28:48 +0100 Subject: [PATCH] Add pagedown widget to index pages introductions. --- opentech/public/funds/models.py | 6 ++++-- opentech/public/news/models.py | 3 ++- opentech/public/people/models.py | 3 ++- opentech/public/projects/models.py | 4 +++- opentech/public/standardpages/models.py | 4 +++- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/opentech/public/funds/models.py b/opentech/public/funds/models.py index ae9acb542..0b1f212eb 100644 --- a/opentech/public/funds/models.py +++ b/opentech/public/funds/models.py @@ -6,6 +6,8 @@ from django.db import models from django.utils.deconstruct import deconstructible from modelcluster.fields import ParentalKey +from pagedown.widgets import PagedownWidget + from wagtail.admin.edit_handlers import ( FieldPanel, FieldRowPanel, @@ -91,7 +93,7 @@ class FundIndex(BasePage): introduction = models.TextField(blank=True) content_panels = BasePage.content_panels + [ - FieldPanel('introduction') + FieldPanel('introduction', widget=PagedownWidget()) ] def get_context(self, request, *args, **kwargs): @@ -216,7 +218,7 @@ class LabIndex(BasePage): introduction = models.TextField(blank=True) content_panels = BasePage.content_panels + [ - FieldPanel('introduction') + FieldPanel('introduction', widget=PagedownWidget()) ] def get_context(self, request, *args, **kwargs): diff --git a/opentech/public/news/models.py b/opentech/public/news/models.py index c5a9f5d3f..d13c4c2c5 100644 --- a/opentech/public/news/models.py +++ b/opentech/public/news/models.py @@ -4,6 +4,7 @@ from django.conf import settings from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator from modelcluster.fields import ParentalKey +from pagedown.widgets import PagedownWidget from wagtail.core.models import Orderable from wagtail.core.fields import StreamField @@ -130,7 +131,7 @@ class NewsIndex(BasePage): introduction = models.TextField(blank=True) content_panels = BasePage.content_panels + [ - FieldPanel('introduction') + FieldPanel('introduction', widget=PagedownWidget()) ] def get_context(self, request, *args, **kwargs): diff --git a/opentech/public/people/models.py b/opentech/public/people/models.py index 4fbe6d31e..c8efecf66 100644 --- a/opentech/public/people/models.py +++ b/opentech/public/people/models.py @@ -4,6 +4,7 @@ from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator from django.conf import settings from modelcluster.fields import ParentalKey +from pagedown.widgets import PagedownWidget from wagtail.core.models import Orderable, PageManager, PageQuerySet from wagtail.core.fields import StreamField @@ -201,7 +202,7 @@ class PersonIndexPage(BasePage): introduction = models.TextField(blank=True) content_panels = BasePage.content_panels + [ - FieldPanel('introduction'), + FieldPanel('introduction', widget=PagedownWidget()), ] search_fields = BasePage.search_fields + [ diff --git a/opentech/public/projects/models.py b/opentech/public/projects/models.py index 70e859544..3f4c6e998 100644 --- a/opentech/public/projects/models.py +++ b/opentech/public/projects/models.py @@ -7,6 +7,8 @@ from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator from django.core.validators import URLValidator from modelcluster.fields import ParentalKey +from pagedown.widgets import PagedownWidget + from wagtail.admin.edit_handlers import ( FieldPanel, InlinePanel, @@ -154,7 +156,7 @@ class ProjectIndexPage(BasePage): introduction = models.TextField(blank=True) content_panels = BasePage.content_panels + [ - FieldPanel('introduction'), + FieldPanel('introduction', widget=PagedownWidget()), ] search_fields = BasePage.search_fields + [ diff --git a/opentech/public/standardpages/models.py b/opentech/public/standardpages/models.py index aebb6b274..75fa8abf5 100644 --- a/opentech/public/standardpages/models.py +++ b/opentech/public/standardpages/models.py @@ -3,6 +3,8 @@ from django.conf import settings from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator from modelcluster.fields import ParentalKey +from pagedown.widgets import PagedownWidget + from wagtail.admin.edit_handlers import ( FieldPanel, StreamFieldPanel, InlinePanel @@ -42,7 +44,7 @@ class IndexPage(BasePage): introduction = models.TextField(blank=True) content_panels = BasePage.content_panels + [ - FieldPanel('introduction'), + FieldPanel('introduction', widget=PagedownWidget()), ] search_fields = BasePage.search_fields + [ -- GitLab