Compare commits

...

11 commits

Author SHA1 Message Date
app
fc6f9e43a7 Merge remote-tracking branch 'origin/master' 2024-07-19 05:54:18 +00:00
app
e4a1cf5a77 Add migration 2023-05-16 11:49:32 +00:00
app
fdfebf783e Converting richtext stream to str 2023-05-16 11:49:02 +00:00
PCoder
fc03ea5927 Add richtext as a block 2023-05-16 16:11:05 +05:30
app
713f9ca9e3 Working version of adding html_content 2023-05-16 10:30:01 +00:00
app
0289586811 Add custom_filters : ph_html_decode 2023-05-16 10:28:45 +00:00
app
a7fdf769c4 Add migration home.0036_auto_20230515_1556 2023-05-15 13:56:56 +00:00
PCoder
1513c1a4d9 Merge remote-tracking branch 'ungleich/11683-add-spotify-mp3' into 11683-add-spotify-mp3 2023-05-15 19:25:08 +05:30
PCoder
5ddcf13803 New changes 2023-05-15 19:23:37 +05:30
app
9f621c9c3e Add migration home.0035_auto_20230515_1447 2023-05-15 12:48:46 +00:00
PCoder
bd2de38428 Add iframe block for article page 2023-05-15 18:14:06 +05:30
7 changed files with 125 additions and 4 deletions

View 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))

View 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),
),
]

View 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),
),
]

View 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),
),
]

View file

@ -185,7 +185,8 @@ class ArticlePage(Page):
('info', InfoBlock(icon='help')), ('info', InfoBlock(icon='help')),
('media', ChoiceBlock(choices=[ ('media', ChoiceBlock(choices=[
('gallery', 'Image gallery'), ('gallery', 'Image gallery'),
], icon='media')) ], icon='media')),
('iframe', RichTextBlock())
], null=True, blank=True) ], null=True, blank=True)
body_fr = StreamField([ body_fr = StreamField([
('paragraph', RichTextBlock()), ('paragraph', RichTextBlock()),
@ -193,7 +194,8 @@ class ArticlePage(Page):
('info', InfoBlock(icon='help')), ('info', InfoBlock(icon='help')),
('media', ChoiceBlock(choices=[ ('media', ChoiceBlock(choices=[
('gallery', 'Image gallery'), ('gallery', 'Image gallery'),
], icon='media')) ], icon='media')),
('iframe', RichTextBlock())
], null=True, blank=True) ], null=True, blank=True)
body_en = StreamField([ body_en = StreamField([
('paragraph', RichTextBlock()), ('paragraph', RichTextBlock()),
@ -201,7 +203,8 @@ class ArticlePage(Page):
('info', InfoBlock(icon='help')), ('info', InfoBlock(icon='help')),
('media', ChoiceBlock(choices=[ ('media', ChoiceBlock(choices=[
('gallery', 'Image gallery'), ('gallery', 'Image gallery'),
], icon='media')) ], icon='media')),
('iframe', RichTextBlock())
], null=True, blank=True) ], null=True, blank=True)
trans_body = TranslatedField( trans_body = TranslatedField(
'body_de', 'body_de',

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">
@ -23,6 +23,10 @@
{% if block.value == 'gallery' %} {% if block.value == 'gallery' %}
{% include 'home/photo_gallery.html' %} {% include 'home/photo_gallery.html' %}
{% endif %} {% endif %}
{% elif block.block_type == 'iframe' %}
{% autoescape off %}
{{ block.value|richtext|ph_html_decode}}
{% endautoescape %}
{% elif block.block_type != 'info' %} {% elif block.block_type != 'info' %}
<p class="block-{{ block.block_type }}"> <p class="block-{{ block.block_type }}">
{% include_block block %} {% include_block block %}

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',
},
}, },
}, },
] ]