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 c13c6991b571d5d184fcdab2afabc605b75074ff..d0f7eb244108b23e1b8b9cd4e70afa9080383c0e 100644 --- a/program2021/models.py +++ b/program2021/models.py @@ -237,7 +237,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 7bcdfcde26e7cf87f0b1998abf15efed2b74ecbb..ea50b14b9c8c4ae8006ea03f7f69271319151779 100644 --- a/program2021/templates/program2021/program2021_point_page.html +++ b/program2021/templates/program2021/program2021_point_page.html @@ -96,10 +96,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 -->