Skip to content
Snippets Groups Projects
Commit 492de66a authored by jarmil's avatar jarmil
Browse files

NEW: jiny obrazek programoveho bodu na titulni stranku

parent 9ed9c956
Branches
No related tags found
No related merge requests found
# Generated by Django 3.0.8 on 2020-08-06 08:54
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("wagtailimages", "0022_uploadedimage"),
("program2021", "0002_auto_20200805_0726"),
]
operations = [
migrations.AddField(
model_name="program2021pointpage",
name="image_title",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.PROTECT,
to="wagtailimages.Image",
verbose_name="titulní obrázek",
),
),
]
...@@ -178,6 +178,13 @@ class Program2021PointPage(Page, MetadataPageMixin): ...@@ -178,6 +178,13 @@ class Program2021PointPage(Page, MetadataPageMixin):
verbose_name="související body", verbose_name="související body",
blank=True, blank=True,
) )
image_title = models.ForeignKey(
"wagtailimages.Image",
verbose_name="titulní obrázek",
on_delete=models.PROTECT,
null=True,
blank=True,
)
images = StreamField( images = StreamField(
[("image", ImageChooserBlock(label="ilustrační obrázek"))], [("image", ImageChooserBlock(label="ilustrační obrázek"))],
verbose_name="ilustrační obrázky", verbose_name="ilustrační obrázky",
...@@ -204,6 +211,7 @@ class Program2021PointPage(Page, MetadataPageMixin): ...@@ -204,6 +211,7 @@ class Program2021PointPage(Page, MetadataPageMixin):
FieldPanel("sources"), FieldPanel("sources"),
FieldPanel("implementation_time"), FieldPanel("implementation_time"),
FieldPanel("code"), FieldPanel("code"),
ImageChooserPanel("image_title"),
], ],
heading="základní informace", heading="základní informace",
), ),
......
...@@ -162,9 +162,7 @@ ...@@ -162,9 +162,7 @@
<a href="{% pageurl point %}"> <a href="{% pageurl point %}">
<div class="card-body"> <div class="card-body">
<div class="mb-3"> <div class="mb-3">
{% if point.images.0.block_type == 'image' %} {% image point.image_title max-400x200 class="lazyload img-fluid w-100" %}
{% image point.images.0.value max-400x200 class="w-100" %}
{% endif %}
</div> </div>
<h5 class="card-title">{{ point.public_title }}</h5> <h5 class="card-title">{{ point.public_title }}</h5>
<p class="card-text">{{ point.annotation }}</p> <p class="card-text">{{ point.annotation }}</p>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment