Skip to content
Snippets Groups Projects
Commit 7523e0ab authored by OndraPetrzilka's avatar OndraPetrzilka
Browse files

changed migration because of imagefields, images with ForeignKey, block...

changed migration because of imagefields, images with ForeignKey, block help_text for SocialIcon, photo_page_header template, edited main person page and main article page
parent e07202c4
No related branches found
No related tags found
3 merge requests!607Pirati.cz,!587added main and profile picture to main person model, main_person template in...,!575Feature/pirati cz
......@@ -140,7 +140,7 @@ class OtherLinksBlock(StructBlock):
class SocialLinkBlock(LinkBlock):
icon = CharBlock(label="Ikona") # TODO CSS class name or somthing better?
icon = CharBlock(label="Ikona", help_text="Seznam ikon - https://styleguide.pirati.cz/latest/?p=viewall-atoms-icons") # TODO CSS class name or somthing better?
# ARTICLE BLOCKS
......
# Generated by Django 4.0.7 on 2022-08-24 10:43
# Generated by Django 4.0.7 on 2022-08-24 13:05
from django.db import migrations, models
import django.db.models.deletion
import wagtail.blocks
import wagtail.fields
......@@ -8,6 +9,7 @@ import wagtail.fields
class Migration(migrations.Migration):
dependencies = [
('wagtailimages', '0024_index_image_file_hash'),
('main', '0011_alter_mainarticlepage_content_and_more'),
]
......@@ -27,7 +29,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='mainpersonpage',
name='main_image',
field=models.ImageField(blank=True, null=True, upload_to='', verbose_name='Hlavní obrázek'),
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='wagtailimages.image', verbose_name='Hlavní obrázek'),
),
migrations.AddField(
model_name='mainpersonpage',
......@@ -37,12 +39,17 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='mainpersonpage',
name='profile_image',
field=models.ImageField(blank=True, null=True, upload_to='', verbose_name='Profilový obrázek'),
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='wagtailimages.image', verbose_name='Profilový obrázek'),
),
migrations.AddField(
model_name='mainpersonpage',
name='social_links',
field=wagtail.fields.StreamField([('social_links', wagtail.blocks.StructBlock([('text', wagtail.blocks.CharBlock(label='Titulkek odkazu (text, který se zobrazí místo dlouhého odkazu)')), ('link', wagtail.blocks.URLBlock(label='Odkaz')), ('icon', wagtail.blocks.CharBlock(label='Ikona'))]))], blank=True, use_json_field=None, verbose_name='Odkazy na sociální sítě'),
field=wagtail.fields.StreamField([('social_links', wagtail.blocks.StructBlock([('text', wagtail.blocks.CharBlock(label='Titulkek odkazu (text, který se zobrazí místo dlouhého odkazu)')), ('link', wagtail.blocks.URLBlock(label='Odkaz')), ('icon', wagtail.blocks.CharBlock(help_text='Seznam ikon - https://styleguide.pirati.cz/latest/?p=viewall-atoms-icons', label='Ikona'))]))], blank=True, use_json_field=None, verbose_name='Odkazy na sociální sítě'),
),
migrations.AlterField(
model_name='mainhomepage',
name='social_links',
field=wagtail.fields.StreamField([('social_links', wagtail.blocks.StructBlock([('text', wagtail.blocks.CharBlock(label='Titulkek odkazu (text, který se zobrazí místo dlouhého odkazu)')), ('link', wagtail.blocks.URLBlock(label='Odkaz')), ('icon', wagtail.blocks.CharBlock(help_text='Seznam ikon - https://styleguide.pirati.cz/latest/?p=viewall-atoms-icons', label='Ikona'))]))], blank=True, use_json_field=None, verbose_name='Odkazy na sociální sítě v zápatí webu'),
),
migrations.AlterField(
model_name='mainpeoplepage',
......
......@@ -415,8 +415,23 @@ class MainPeoplePage(ExtendedMetadataPageMixin, SubpageMixin, MetadataPageMixin,
class MainPersonPage(ExtendedMetadataPageMixin, SubpageMixin, MetadataPageMixin, Page):
### FIELDS
main_image = models.ImageField("Hlavní obrázek", blank=True, null=True)
profile_image = models.ImageField("Profilový obrázek", blank=True, null=True)
main_image = models.ForeignKey(
"wagtailimages.Image",
on_delete=models.PROTECT,
blank=True,
null=True,
verbose_name="Hlavní obrázek",
related_name="+"
)
profile_image = models.ForeignKey(
"wagtailimages.Image",
on_delete=models.PROTECT,
blank=True,
null=True,
verbose_name="Profilový obrázek",
related_name="+"
)
before_name = models.CharField(
"Tituly před jménem", max_length=16, blank=True, null=True
)
......
{% load wagtailcore_tags %}
<header
class="bg-black flex items-center header-clip photo-header py-32 mb-20 w-full bg-no-repeat bg-cover bg-center"
style="background-image: url('{{ image_url | default_if_none:"https://cc.cz/wp-content/uploads/2022/04/bartos-otv.jpg" }}')"
>
<div class="grid-container header-max-width pt-16">
<div class="pl-4 pr-2 col-start-1 col-end-3 sm:col-start-2 sm:col-end-13 sm:pr-0">
<h1 class="font-alt text-white">
<span class="text-2xl">{{ before_title | default_if_none:"" }}</span><br>
<span class="font-alt text-7xl">{{ page.title | default_if_none:"" }}</span><span class="text-2xl">{{ after_title | default_if_none:"" }}</span><br>
<span class="font-alt">{{ subtitle | default_if_none:"" }}</span>
</h1>
</div>
</div>
</header>
\ No newline at end of file
......@@ -2,14 +2,16 @@
{% load static wagtailcore_tags wagtailimages_tags wagtailroutablepage_tags %}
{% block content %}
{% include 'main/includes/layout/simple_page_header.html' %}
{% image page.image max-3840x2160 as main_img %}
{% with before_title=page.date after_title=page.after_name subtitle=page.position image_url=main_img.url %}
{% include 'main/includes/layout/photo_page_header.html' %}
{% endwith %}
{# {% routablepageurl page.root_page.articles_page "tags" as articles_tag_page_url %}#}
<main role="main" class="mb-10 xl:mb-32">
<div class="grid-container mb-2 lg:mb-12">
<div class="grid-left-side h-full bg-grey-150 left-tab">
<div class="p-6">
<span class="font-bold 3xl:text-xl">AUTOR ČLÁNKU: <br> {{ page.author }}</span><br>
<span class="font-bold 3xl:text-xl">AUTOR ČLÁNKU: <br> {{ page.author_page.title }}</span><br>
</div>
</div>
<div class="grid-content leading-6">
......
......@@ -3,11 +3,17 @@
{% block content %}
<main role="main">
{% image page.main_image max-3840x2160 as main_img %}
{% with before_title=page.before_name after_title=page.after_name subtitle=page.position image_url=main_img.url %}
{% include 'main/includes/layout/photo_page_header.html' %}
{% endwith %}
<div class="">
<section class="grid-container person-grid-container">
<div class="grid-content leading-6">
<article class="mb-4 xl:mb-24 xl:mr-2">
<p class="font-alt mb-5">
{{ page.perex }}
</p>
<p class="font-alt mb-5">
{{ page.text|richtext }}
</p>
......@@ -113,9 +119,10 @@
<div class="flex flex-wrap">
<div class="flex mb-16 person-box-medium">
<div class="shrink-0 mr-4">
{% image person.profile_image max-250x250 as profile_image %}
<img
class="rounded-full shadow-sm w-20 mb-2 xl:w-44"
src="{{ person.profile_image.url }}"
src="{{ profile_image.url }}"
alt=" {{ person.title }}"
>
</div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment