Correct usage of 'media' field

This commit is contained in:
Oleg Lavrovsky 2017-09-20 12:05:58 +02:00
parent abcd4850d3
commit bcbed2edc6
5 changed files with 51 additions and 52 deletions

View File

@ -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

View File

@ -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'),
),
]

View File

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

View File

@ -1,50 +0,0 @@
{% load wagtailcore_tags wagtailimages_tags %}
{% if page.feed_image %}
<div class="image">
{% image page.feed_image fill-940x400 class="img-responsive" %}
</div>
{% endif %}
<h2>{{ page.trans_title }}</h2>
<p class="lead">{{ page.trans_intro|richtext }}</p>
{% if page.date %}
<p class="date">{{ page.date }}</p>
{% endif %}
<!-- Main content -->
<div class="article-body" role="main">
{% for block in page.trans_body %}
{% if block.block_type == 'heading' %}
<h3>{{ block.value }}</h3>
{% elif block.block_type != 'info' %}
<p class="block-{{ block.block_type }}">
{% include_block block %}
</p>
{% endif %}
{% endfor %}
</div>
<!-- Infoblocks -->
<div class="row infoblocks">
{% for block in page.trans_body %}
{% if block.block_type == 'info' %}
<article class="col-md-4">
<div class="image">
{% image block.value.photo fill-300x300 %}
</div>
<header>
<h3>{{ block.value.title }}</h3>
</header>
{{ block.value.summary|richtext }}
{% if block.value.action %}
<footer>
<a href="{{ block.value.url }}" class="btn btn-default">{{ block.value.action }}</a>
</footer>
{% endif %}
</article>
{% endif %}
{% endfor %}
</div>

View File

@ -19,7 +19,7 @@
{% for block in page.trans_body %}
{% if block.block_type == 'heading' %}
<h3>{{ block.value }}</h3>
{% elif block.block_type == 'placer' %}
{% elif block.block_type == 'media' %}
{% if block.value == 'gallery' %}
{% include 'home/photo_gallery.html' %}
{% endif %}