Compare commits
11 commits
34ad67e8cd
...
fc6f9e43a7
Author | SHA1 | Date | |
---|---|---|---|
|
fc6f9e43a7 | ||
|
e4a1cf5a77 | ||
|
fdfebf783e | ||
|
fc03ea5927 | ||
|
713f9ca9e3 | ||
|
0289586811 | ||
|
a7fdf769c4 | ||
|
1513c1a4d9 | ||
|
5ddcf13803 | ||
|
9f621c9c3e | ||
|
bd2de38428 |
7 changed files with 125 additions and 4 deletions
8
publichealth/home/custom_filters.py
Normal file
8
publichealth/home/custom_filters.py
Normal file
|
@ -0,0 +1,8 @@
|
|||
from django import template
|
||||
from html import unescape
|
||||
|
||||
register = template.Library()
|
||||
|
||||
@register.filter
|
||||
def ph_html_decode(value):
|
||||
return unescape(str(value))
|
32
publichealth/home/migrations/0035_auto_20230515_1447.py
Normal file
32
publichealth/home/migrations/0035_auto_20230515_1447.py
Normal file
|
@ -0,0 +1,32 @@
|
|||
# Generated by Django 3.2.13 on 2023-05-15 12:47
|
||||
|
||||
from django.db import migrations
|
||||
import wagtail.core.blocks
|
||||
import wagtail.core.fields
|
||||
import wagtail.embeds.blocks
|
||||
import wagtail.images.blocks
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('home', '0034_auto_20220714_1145'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='articlepage',
|
||||
name='body_de',
|
||||
field=wagtail.core.fields.StreamField([('paragraph', wagtail.core.blocks.RichTextBlock()), ('section', wagtail.core.blocks.CharBlock(form_classname='full title')), ('info', wagtail.core.blocks.StructBlock([('title', wagtail.core.blocks.CharBlock(required=True)), ('photo', wagtail.images.blocks.ImageChooserBlock(required=True)), ('summary', wagtail.core.blocks.RichTextBlock(required=True)), ('action', wagtail.core.blocks.CharBlock(required=False)), ('url', wagtail.core.blocks.URLBlock(required=False))], icon='help')), ('media', wagtail.core.blocks.ChoiceBlock(choices=[('gallery', 'Image gallery')], icon='media')), ('iframe', wagtail.embeds.blocks.EmbedBlock())], blank=True, null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='articlepage',
|
||||
name='body_en',
|
||||
field=wagtail.core.fields.StreamField([('paragraph', wagtail.core.blocks.RichTextBlock()), ('section', wagtail.core.blocks.CharBlock(form_classname='full title')), ('info', wagtail.core.blocks.StructBlock([('title', wagtail.core.blocks.CharBlock(required=True)), ('photo', wagtail.images.blocks.ImageChooserBlock(required=True)), ('summary', wagtail.core.blocks.RichTextBlock(required=True)), ('action', wagtail.core.blocks.CharBlock(required=False)), ('url', wagtail.core.blocks.URLBlock(required=False))], icon='help')), ('media', wagtail.core.blocks.ChoiceBlock(choices=[('gallery', 'Image gallery')], icon='media')), ('iframe', wagtail.embeds.blocks.EmbedBlock())], blank=True, null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='articlepage',
|
||||
name='body_fr',
|
||||
field=wagtail.core.fields.StreamField([('paragraph', wagtail.core.blocks.RichTextBlock()), ('section', wagtail.core.blocks.CharBlock(form_classname='full title')), ('info', wagtail.core.blocks.StructBlock([('title', wagtail.core.blocks.CharBlock(required=True)), ('photo', wagtail.images.blocks.ImageChooserBlock(required=True)), ('summary', wagtail.core.blocks.RichTextBlock(required=True)), ('action', wagtail.core.blocks.CharBlock(required=False)), ('url', wagtail.core.blocks.URLBlock(required=False))], icon='help')), ('media', wagtail.core.blocks.ChoiceBlock(choices=[('gallery', 'Image gallery')], icon='media')), ('iframe', wagtail.embeds.blocks.EmbedBlock())], blank=True, null=True),
|
||||
),
|
||||
]
|
36
publichealth/home/migrations/0036_auto_20230515_1556.py
Normal file
36
publichealth/home/migrations/0036_auto_20230515_1556.py
Normal file
|
@ -0,0 +1,36 @@
|
|||
# Generated by Django 3.2.13 on 2023-05-15 13:56
|
||||
|
||||
from django.db import migrations
|
||||
import wagtail.core.blocks
|
||||
import wagtail.core.fields
|
||||
import wagtail.images.blocks
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('home', '0035_auto_20230515_1447'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='articlepage',
|
||||
name='html_content',
|
||||
field=wagtail.core.fields.RichTextField(blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='articlepage',
|
||||
name='body_de',
|
||||
field=wagtail.core.fields.StreamField([('paragraph', wagtail.core.blocks.RichTextBlock()), ('section', wagtail.core.blocks.CharBlock(form_classname='full title')), ('info', wagtail.core.blocks.StructBlock([('title', wagtail.core.blocks.CharBlock(required=True)), ('photo', wagtail.images.blocks.ImageChooserBlock(required=True)), ('summary', wagtail.core.blocks.RichTextBlock(required=True)), ('action', wagtail.core.blocks.CharBlock(required=False)), ('url', wagtail.core.blocks.URLBlock(required=False))], icon='help')), ('media', wagtail.core.blocks.ChoiceBlock(choices=[('gallery', 'Image gallery')], icon='media'))], blank=True, null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='articlepage',
|
||||
name='body_en',
|
||||
field=wagtail.core.fields.StreamField([('paragraph', wagtail.core.blocks.RichTextBlock()), ('section', wagtail.core.blocks.CharBlock(form_classname='full title')), ('info', wagtail.core.blocks.StructBlock([('title', wagtail.core.blocks.CharBlock(required=True)), ('photo', wagtail.images.blocks.ImageChooserBlock(required=True)), ('summary', wagtail.core.blocks.RichTextBlock(required=True)), ('action', wagtail.core.blocks.CharBlock(required=False)), ('url', wagtail.core.blocks.URLBlock(required=False))], icon='help')), ('media', wagtail.core.blocks.ChoiceBlock(choices=[('gallery', 'Image gallery')], icon='media'))], blank=True, null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='articlepage',
|
||||
name='body_fr',
|
||||
field=wagtail.core.fields.StreamField([('paragraph', wagtail.core.blocks.RichTextBlock()), ('section', wagtail.core.blocks.CharBlock(form_classname='full title')), ('info', wagtail.core.blocks.StructBlock([('title', wagtail.core.blocks.CharBlock(required=True)), ('photo', wagtail.images.blocks.ImageChooserBlock(required=True)), ('summary', wagtail.core.blocks.RichTextBlock(required=True)), ('action', wagtail.core.blocks.CharBlock(required=False)), ('url', wagtail.core.blocks.URLBlock(required=False))], icon='help')), ('media', wagtail.core.blocks.ChoiceBlock(choices=[('gallery', 'Image gallery')], icon='media'))], blank=True, null=True),
|
||||
),
|
||||
]
|
35
publichealth/home/migrations/0037_auto_20230516_1241.py
Normal file
35
publichealth/home/migrations/0037_auto_20230516_1241.py
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Generated by Django 3.2.13 on 2023-05-16 10:41
|
||||
|
||||
from django.db import migrations
|
||||
import wagtail.core.blocks
|
||||
import wagtail.core.fields
|
||||
import wagtail.images.blocks
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('home', '0036_auto_20230515_1556'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='articlepage',
|
||||
name='html_content',
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='articlepage',
|
||||
name='body_de',
|
||||
field=wagtail.core.fields.StreamField([('paragraph', wagtail.core.blocks.RichTextBlock()), ('section', wagtail.core.blocks.CharBlock(form_classname='full title')), ('info', wagtail.core.blocks.StructBlock([('title', wagtail.core.blocks.CharBlock(required=True)), ('photo', wagtail.images.blocks.ImageChooserBlock(required=True)), ('summary', wagtail.core.blocks.RichTextBlock(required=True)), ('action', wagtail.core.blocks.CharBlock(required=False)), ('url', wagtail.core.blocks.URLBlock(required=False))], icon='help')), ('media', wagtail.core.blocks.ChoiceBlock(choices=[('gallery', 'Image gallery')], icon='media')), ('iframe', wagtail.core.blocks.RichTextBlock())], blank=True, null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='articlepage',
|
||||
name='body_en',
|
||||
field=wagtail.core.fields.StreamField([('paragraph', wagtail.core.blocks.RichTextBlock()), ('section', wagtail.core.blocks.CharBlock(form_classname='full title')), ('info', wagtail.core.blocks.StructBlock([('title', wagtail.core.blocks.CharBlock(required=True)), ('photo', wagtail.images.blocks.ImageChooserBlock(required=True)), ('summary', wagtail.core.blocks.RichTextBlock(required=True)), ('action', wagtail.core.blocks.CharBlock(required=False)), ('url', wagtail.core.blocks.URLBlock(required=False))], icon='help')), ('media', wagtail.core.blocks.ChoiceBlock(choices=[('gallery', 'Image gallery')], icon='media')), ('iframe', wagtail.core.blocks.RichTextBlock())], blank=True, null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='articlepage',
|
||||
name='body_fr',
|
||||
field=wagtail.core.fields.StreamField([('paragraph', wagtail.core.blocks.RichTextBlock()), ('section', wagtail.core.blocks.CharBlock(form_classname='full title')), ('info', wagtail.core.blocks.StructBlock([('title', wagtail.core.blocks.CharBlock(required=True)), ('photo', wagtail.images.blocks.ImageChooserBlock(required=True)), ('summary', wagtail.core.blocks.RichTextBlock(required=True)), ('action', wagtail.core.blocks.CharBlock(required=False)), ('url', wagtail.core.blocks.URLBlock(required=False))], icon='help')), ('media', wagtail.core.blocks.ChoiceBlock(choices=[('gallery', 'Image gallery')], icon='media')), ('iframe', wagtail.core.blocks.RichTextBlock())], blank=True, null=True),
|
||||
),
|
||||
]
|
|
@ -185,7 +185,8 @@ class ArticlePage(Page):
|
|||
('info', InfoBlock(icon='help')),
|
||||
('media', ChoiceBlock(choices=[
|
||||
('gallery', 'Image gallery'),
|
||||
], icon='media'))
|
||||
], icon='media')),
|
||||
('iframe', RichTextBlock())
|
||||
], null=True, blank=True)
|
||||
body_fr = StreamField([
|
||||
('paragraph', RichTextBlock()),
|
||||
|
@ -193,7 +194,8 @@ class ArticlePage(Page):
|
|||
('info', InfoBlock(icon='help')),
|
||||
('media', ChoiceBlock(choices=[
|
||||
('gallery', 'Image gallery'),
|
||||
], icon='media'))
|
||||
], icon='media')),
|
||||
('iframe', RichTextBlock())
|
||||
], null=True, blank=True)
|
||||
body_en = StreamField([
|
||||
('paragraph', RichTextBlock()),
|
||||
|
@ -201,7 +203,8 @@ class ArticlePage(Page):
|
|||
('info', InfoBlock(icon='help')),
|
||||
('media', ChoiceBlock(choices=[
|
||||
('gallery', 'Image gallery'),
|
||||
], icon='media'))
|
||||
], icon='media')),
|
||||
('iframe', RichTextBlock())
|
||||
], null=True, blank=True)
|
||||
trans_body = TranslatedField(
|
||||
'body_de',
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{% load wagtailcore_tags wagtailimages_tags %}
|
||||
{% load wagtailcore_tags wagtailimages_tags custom_filters %}
|
||||
|
||||
{% if page.feed_image %}
|
||||
<div class="image">
|
||||
|
@ -23,6 +23,10 @@
|
|||
{% if block.value == 'gallery' %}
|
||||
{% include 'home/photo_gallery.html' %}
|
||||
{% endif %}
|
||||
{% elif block.block_type == 'iframe' %}
|
||||
{% autoescape off %}
|
||||
{{ block.value|richtext|ph_html_decode}}
|
||||
{% endautoescape %}
|
||||
{% elif block.block_type != 'info' %}
|
||||
<p class="block-{{ block.block_type }}">
|
||||
{% include_block block %}
|
||||
|
|
|
@ -109,6 +109,9 @@ TEMPLATES = [
|
|||
'django.contrib.auth.context_processors.auth',
|
||||
'django.contrib.messages.context_processors.messages',
|
||||
],
|
||||
'libraries': {
|
||||
'custom_filters': 'publichealth.home.custom_filters',
|
||||
},
|
||||
},
|
||||
},
|
||||
]
|
||||
|
|
Loading…
Reference in a new issue