From bcbed2edc608f17c87a19d0ed82d5eccc03c70af Mon Sep 17 00:00:00 2001 From: Oleg Lavrovsky Date: Wed, 20 Sep 2017 12:05:58 +0200 Subject: [PATCH] Correct usage of 'media' field --- Makefile | 2 +- feedler/migrations/0005_auto_20170920_1204.py | 21 ++++++++ .../migrations/0020_auto_20170920_1204.py | 28 +++++++++++ .../home/templates/home/article_content.html | 50 ------------------- .../home/templates/home/page_content.html | 2 +- 5 files changed, 51 insertions(+), 52 deletions(-) create mode 100644 feedler/migrations/0005_auto_20170920_1204.py create mode 100644 publichealth/home/migrations/0020_auto_20170920_1204.py delete mode 100644 publichealth/home/templates/home/article_content.html diff --git a/Makefile b/Makefile index b3a7aa2..3914c67 100644 --- a/Makefile +++ b/Makefile @@ -99,6 +99,6 @@ pg-restore: pg-surefire-drop-restore-db: # drop existing database, recreate it, and then restore its content from backup. - -docker-compose exec postgres bash -c 'dropdb -h localhost -U postgres postgres' + docker-compose exec postgres bash -c 'dropdb -h localhost -U postgres postgres' docker-compose exec postgres bash -c 'createdb -h localhost -U postgres postgres' make pg-restore diff --git a/feedler/migrations/0005_auto_20170920_1204.py b/feedler/migrations/0005_auto_20170920_1204.py new file mode 100644 index 0000000..33159e6 --- /dev/null +++ b/feedler/migrations/0005_auto_20170920_1204.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.4 on 2017-09-20 10:04 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('feedler', '0004_auto_20170905_1502'), + ] + + operations = [ + migrations.AlterField( + model_name='entry', + name='stream', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='feedler.Stream', verbose_name='Original stream'), + ), + ] diff --git a/publichealth/home/migrations/0020_auto_20170920_1204.py b/publichealth/home/migrations/0020_auto_20170920_1204.py new file mode 100644 index 0000000..86bf257 --- /dev/null +++ b/publichealth/home/migrations/0020_auto_20170920_1204.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.4 on 2017-09-20 10:04 +from __future__ import unicode_literals + +from django.db import migrations +import wagtail.wagtailcore.blocks +import wagtail.wagtailcore.fields +import wagtail.wagtailimages.blocks + + +class Migration(migrations.Migration): + + dependencies = [ + ('home', '0019_auto_20170908_1505'), + ] + + operations = [ + migrations.AlterField( + model_name='articlepage', + name='body_de', + field=wagtail.wagtailcore.fields.StreamField((('paragraph', wagtail.wagtailcore.blocks.RichTextBlock()), ('section', wagtail.wagtailcore.blocks.CharBlock(classname='full title')), ('info', wagtail.wagtailcore.blocks.StructBlock((('title', wagtail.wagtailcore.blocks.CharBlock(required=True)), ('photo', wagtail.wagtailimages.blocks.ImageChooserBlock(required=True)), ('summary', wagtail.wagtailcore.blocks.RichTextBlock(required=True)), ('action', wagtail.wagtailcore.blocks.CharBlock(required=False)), ('url', wagtail.wagtailcore.blocks.URLBlock(required=False))), icon='help')), ('media', wagtail.wagtailcore.blocks.ChoiceBlock(choices=[('gallery', 'Image gallery')], icon='media'))), blank=True, null=True), + ), + migrations.AlterField( + model_name='articlepage', + name='body_fr', + field=wagtail.wagtailcore.fields.StreamField((('paragraph', wagtail.wagtailcore.blocks.RichTextBlock()), ('section', wagtail.wagtailcore.blocks.CharBlock(classname='full title')), ('info', wagtail.wagtailcore.blocks.StructBlock((('title', wagtail.wagtailcore.blocks.CharBlock(required=True)), ('photo', wagtail.wagtailimages.blocks.ImageChooserBlock(required=True)), ('summary', wagtail.wagtailcore.blocks.RichTextBlock(required=True)), ('action', wagtail.wagtailcore.blocks.CharBlock(required=False)), ('url', wagtail.wagtailcore.blocks.URLBlock(required=False))), icon='help')), ('media', wagtail.wagtailcore.blocks.ChoiceBlock(choices=[('gallery', 'Image gallery')], icon='media'))), blank=True, null=True), + ), + ] diff --git a/publichealth/home/templates/home/article_content.html b/publichealth/home/templates/home/article_content.html deleted file mode 100644 index d8b778d..0000000 --- a/publichealth/home/templates/home/article_content.html +++ /dev/null @@ -1,50 +0,0 @@ -{% load wagtailcore_tags wagtailimages_tags %} - -{% if page.feed_image %} -
- {% image page.feed_image fill-940x400 class="img-responsive" %} -
-{% endif %} - -

{{ page.trans_title }}

- -

{{ page.trans_intro|richtext }}

- -{% if page.date %} -

{{ page.date }}

-{% endif %} - - -
-{% for block in page.trans_body %} - {% if block.block_type == 'heading' %} -

{{ block.value }}

- {% elif block.block_type != 'info' %} -

- {% include_block block %} -

- {% endif %} -{% endfor %} -
- - -
-{% for block in page.trans_body %} - {% if block.block_type == 'info' %} -
-
- {% image block.value.photo fill-300x300 %} -
-
-

{{ block.value.title }}

-
- {{ block.value.summary|richtext }} - {% if block.value.action %} - - {% endif %} -
- {% endif %} -{% endfor %} -
diff --git a/publichealth/home/templates/home/page_content.html b/publichealth/home/templates/home/page_content.html index 5c32aeb..a2c4165 100644 --- a/publichealth/home/templates/home/page_content.html +++ b/publichealth/home/templates/home/page_content.html @@ -19,7 +19,7 @@ {% for block in page.trans_body %} {% if block.block_type == 'heading' %}

{{ block.value }}

- {% elif block.block_type == 'placer' %} + {% elif block.block_type == 'media' %} {% if block.value == 'gallery' %} {% include 'home/photo_gallery.html' %} {% endif %}