Working version of adding html_content

This commit is contained in:
app 2023-05-16 10:30:01 +00:00
parent 0289586811
commit 713f9ca9e3
3 changed files with 7 additions and 4 deletions

View file

@ -257,8 +257,6 @@ class ArticlePage(Page):
ImageChooserPanel('feed_image'), ImageChooserPanel('feed_image'),
], heading="Images"), ], heading="Images"),
StreamFieldPanel('gallery'), StreamFieldPanel('gallery'),
]
content_panels = Page.content_panels + [
FieldPanel('html_content', classname='full'), FieldPanel('html_content', classname='full'),
] ]
promote_panels = [ promote_panels = [

View file

@ -1,4 +1,4 @@
{% load wagtailcore_tags wagtailimages_tags %} {% load wagtailcore_tags wagtailimages_tags custom_filters %}
{% if page.feed_image %} {% if page.feed_image %}
<div class="image"> <div class="image">
@ -34,7 +34,9 @@
{% if page.html_content %} {% if page.html_content %}
<!-- Any other content --> <!-- Any other content -->
<div class="article-body"> <div class="article-body">
{{ page.html_content|richtext }} {% autoescape off %}
{{ page.html_content|ph_html_decode }}
{% endautoescape %}
</div> </div>
{% endif %} {% endif %}

View file

@ -109,6 +109,9 @@ TEMPLATES = [
'django.contrib.auth.context_processors.auth', 'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages', 'django.contrib.messages.context_processors.messages',
], ],
'libraries': {
'custom_filters': 'publichealth.home.custom_filters',
},
}, },
}, },
] ]