Skip to content
Snippets Groups Projects
Commit 5f3952c8 authored by Štěpán Farka's avatar Štěpán Farka Committed by jan.bednarik
Browse files

[ADD] administrate support image

parent ecdcbb4e
Branches
No related tags found
2 merge requests!518Release,!514Donate enhancements 2
# Generated by Django 4.0.4 on 2022-05-25 06:15
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("wagtailimages", "0023_add_choose_permissions"),
("donate", "0020_donateinfopage_form_amount_1_and_more"),
]
operations = [
migrations.AddField(
model_name="donatehomepage",
name="support_image",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.PROTECT,
related_name="+",
to="wagtailimages.image",
verbose_name="Obrázek k darovacímu widgetu",
),
),
]
......@@ -112,6 +112,14 @@ class DonateHomePage(
# support section
support_title = models.CharField("podpoř stranu nadpis", max_length=250, blank=True)
support_body = models.TextField("podpoř stranu popis", blank=True)
support_image = models.ForeignKey(
"wagtailimages.Image",
on_delete=models.PROTECT,
blank=True,
null=True,
related_name="+",
verbose_name="Obrázek k darovacímu widgetu",
)
# projects section
project_title = models.CharField(
"podpoř projekt nadpis", max_length=250, blank=True
......@@ -142,7 +150,11 @@ class DonateHomePage(
"hlavní sekce",
),
MultiFieldPanel(
[FieldPanel("support_title"), FieldPanel("support_body")],
[
FieldPanel("support_title"),
FieldPanel("support_body"),
ImageChooserPanel("support_image"),
],
"podpoř stranu",
),
MultiFieldPanel(
......
......@@ -44,11 +44,14 @@
<h2 class="lead page-subheading mb-4">{{ page.support_title }}</h2>
<p class="mb-4">{{ page.support_body }}</p>
<div class="donate-form">
<div class="donate-form__left">
<div class="donate-form__icon">
<img data-src="{% static "donate/img/ivan.png" %}" class="lazyload img-fluid" alt="Ikona daru">
</div><!-- /donate-form__icon -->
</div><!-- /donate-form__left -->
{% if page.support_image %}
<div class="donate-form__left">
<div class="donate-form__icon">
{% image page.support_image fill-256x256 as img %}
<img data-src="{{ img.url }}" class="lazyload img-fluid" alt="{{ img.alt }}">
</div><!-- /donate-form__icon -->
</div><!-- /donate-form__left -->
{% endif %}
<div class="donate-form__right">
<form id="js-donate-form" method="post">
{% csrf_token %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment