diff --git a/program2021/migrations/0004_auto_20200930_1156.py b/program2021/migrations/0004_auto_20200930_1156.py new file mode 100644 index 0000000000000000000000000000000000000000..7c8bb8c2afb16cd01df91ca48adc9376612f779a --- /dev/null +++ b/program2021/migrations/0004_auto_20200930_1156.py @@ -0,0 +1,41 @@ +# Generated by Django 3.1.1 on 2020-09-30 09:56 + +import wagtail.core.blocks +import wagtail.core.fields +import wagtail.images.blocks +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("program2021", "0003_program2021pointpage_image_title"), + ] + + operations = [ + migrations.AlterField( + model_name="program2021pointpage", + name="images", + field=wagtail.core.fields.StreamField( + [ + ( + "item", + wagtail.core.blocks.StructBlock( + [ + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + label="ilustračnà obrázek" + ), + ), + ("title", wagtail.core.blocks.CharBlock(label="popis")), + ], + label="obrázek", + ), + ) + ], + blank=True, + verbose_name="ilustračnà obrázky", + ), + ), + ] diff --git a/program2021/models.py b/program2021/models.py index 9d10e0812cf25614d27e82aeab90d9afc12e978a..02cc2da817921b33c019363a78b7bd21a00c2deb 100644 --- a/program2021/models.py +++ b/program2021/models.py @@ -186,7 +186,18 @@ class Program2021PointPage(Page, MetadataPageMixin): blank=True, ) images = StreamField( - [("image", ImageChooserBlock(label="ilustračnà obrázek"))], + [ + ( + "item", + blocks.StructBlock( + [ + ("image", ImageChooserBlock(label="ilustračnà obrázek")), + ("title", blocks.CharBlock(label="popis")), + ], + label="obrázek", + ), + ), + ], verbose_name="ilustračnà obrázky", blank=True, ) diff --git a/program2021/templates/program2021/program2021_point_page.html b/program2021/templates/program2021/program2021_point_page.html index e9d5d99c44729e603609d3f7df25cf6fd7c6186f..b8bfc8025aa7bba4b03cf7d5b11fbae2fd93ebe9 100644 --- a/program2021/templates/program2021/program2021_point_page.html +++ b/program2021/templates/program2021/program2021_point_page.html @@ -92,10 +92,11 @@ {% if page.images %} <div class="row about-images mb-5 mt-3 jumbotron"> {% for block in page.images %} - {% image block.value width-2000 as img %} - {% image block.value fill-300x200 as thumb %} + {% image block.value.image width-2000 as img %} + {% image block.value.image fill-300x200 as thumb %} <div class="col-6 col-md-3 mb-4"> - <a data-fancybox="gallery" href="{{ img.url }}"><img data-src="{{ thumb.url }}" class="lazyload img-fluid" alt="{{ thumb.alt }}"></a> + <a data-fancybox="gallery" href="{{ img.url }}"><img data-src="{{ thumb.url }}" class="lazyload img-fluid" alt="{{ block.value.title }}"></a><br> + {{ block.value.title }} </div><!-- /column --> {% endfor %} </div><!-- /row -->