Skip to content
Snippets Groups Projects
Commit d8d1353c authored by Tomáš Valenta's avatar Tomáš Valenta
Browse files

add article page, mobile UI, UI fixes

parent 6b973124
No related branches found
No related tags found
No related merge requests found
Showing
with 330 additions and 810 deletions
......@@ -34,6 +34,7 @@ class DocumentBlock(StructBlock):
class EventBlock(StructBlock):
name = CharBlock(label="Jméno")
url = URLBlock(label="URL")
date = DateBlock(label="Datum konání", required=False)
location = CharBlock(label="Lokace", required=False)
......
# -*- coding: utf-8 -*-
# Generated by Django 4.2.2 on 2023-07-23 12:14
from django.db import migrations, models
import django.db.models.deletion
import wagtail.blocks
import wagtail.documents.blocks
import wagtail.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
("wagtailcore", "0040_page_draft_title"),
('wagtailcore', '0083_workflowcontenttype'),
]
operations = [
migrations.CreateModel(
name="HomePage",
name='HomeArticlesPage',
fields=[
(
"page_ptr",
models.OneToOneField(
on_delete=models.CASCADE,
parent_link=True,
auto_created=True,
primary_key=True,
serialize=False,
to="wagtailcore.Page",
),
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.page')),
('author', models.CharField(verbose_name='Autor')),
('perex', wagtail.fields.RichTextField(verbose_name='Perex')),
('content', wagtail.fields.RichTextField(verbose_name='Obsah')),
],
options={
'abstract': False,
},
bases=('wagtailcore.page',),
),
migrations.CreateModel(
name='HomePage',
fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.page')),
('heading_text', wagtail.fields.RichTextField(verbose_name='Hlavní text stránky')),
('events', wagtail.fields.StreamField([('event', wagtail.blocks.StructBlock([('name', wagtail.blocks.CharBlock(label='Jméno')), ('url', wagtail.blocks.URLBlock(label='URL')), ('date', wagtail.blocks.DateBlock(label='Datum konání', required=False)), ('location', wagtail.blocks.CharBlock(label='Lokace', required=False))]))], blank=True, null=True, use_json_field=True, verbose_name='Události')),
('documents', wagtail.fields.StreamField([('document', wagtail.blocks.StructBlock([('name', wagtail.blocks.CharBlock(label='Jméno')), ('date_added', wagtail.blocks.DateBlock(label='Datum přidání', required=False)), ('url', wagtail.blocks.URLBlock(label='URL (místo dokumentu)', required=False)), ('file', wagtail.documents.blocks.DocumentChooserBlock(label='Dokument', required=False))]))], blank=True, null=True, use_json_field=True, verbose_name='Dokumenty')),
('donation_text', wagtail.fields.RichTextField(verbose_name='Text pro dary')),
('address', models.CharField(verbose_name='Sídlo')),
('branch', models.CharField(verbose_name='Pobočka')),
('email', models.EmailField(max_length=254, verbose_name='Email')),
('ds_id', models.CharField(verbose_name='Datová schránka')),
('director', wagtail.fields.StreamField([('person', wagtail.blocks.StructBlock([('name', wagtail.blocks.CharBlock(label='Jméno')), ('position', wagtail.blocks.TextBlock(label='Pracovní pozice', required=False)), ('email', wagtail.blocks.EmailBlock(label='E-mailová adresa', required=False))]))], blank=True, null=True, use_json_field=True, verbose_name='Ředitel')),
('controller', wagtail.fields.StreamField([('person', wagtail.blocks.StructBlock([('name', wagtail.blocks.CharBlock(label='Jméno')), ('position', wagtail.blocks.TextBlock(label='Pracovní pozice', required=False)), ('email', wagtail.blocks.EmailBlock(label='E-mailová adresa', required=False))]))], blank=True, null=True, use_json_field=True, verbose_name='Kontrolor')),
('council_members', wagtail.fields.StreamField([('person', wagtail.blocks.StructBlock([('name', wagtail.blocks.CharBlock(label='Jméno')), ('position', wagtail.blocks.TextBlock(label='Pracovní pozice', required=False)), ('email', wagtail.blocks.EmailBlock(label='E-mailová adresa', required=False))]))], blank=True, null=True, use_json_field=True, verbose_name='Správní rada')),
('volunteers', wagtail.fields.StreamField([('person', wagtail.blocks.StructBlock([('name', wagtail.blocks.CharBlock(label='Jméno')), ('position', wagtail.blocks.TextBlock(label='Pracovní pozice', required=False)), ('email', wagtail.blocks.EmailBlock(label='E-mailová adresa', required=False))]))], blank=True, null=True, use_json_field=True, verbose_name='Dobrovolníci')),
('employees', wagtail.fields.StreamField([('person', wagtail.blocks.StructBlock([('name', wagtail.blocks.CharBlock(label='Jméno')), ('position', wagtail.blocks.TextBlock(label='Pracovní pozice', required=False)), ('email', wagtail.blocks.EmailBlock(label='E-mailová adresa', required=False))]))], blank=True, null=True, use_json_field=True, verbose_name='Zaměstnanci')),
],
options={
"abstract": False,
'abstract': False,
},
bases=("wagtailcore.page",),
bases=('wagtailcore.page',),
),
]
# -*- coding: utf-8 -*-
from django.db import migrations
def create_homepage(apps, schema_editor):
# Get models
ContentType = apps.get_model("contenttypes.ContentType")
Page = apps.get_model("wagtailcore.Page")
Site = apps.get_model("wagtailcore.Site")
HomePage = apps.get_model("home.HomePage")
# Delete the default homepage
# If migration is run multiple times, it may have already been deleted
Page.objects.filter(id=2).delete()
# Create content type for homepage model
homepage_content_type, __ = ContentType.objects.get_or_create(
model="homepage", app_label="home"
)
# Create a new homepage
homepage = HomePage.objects.create(
title="Home",
draft_title="Home",
slug="home",
content_type=homepage_content_type,
path="00010001",
depth=2,
numchild=0,
url_path="/home/",
)
# Create a site with the new homepage set as the root
Site.objects.create(hostname="localhost", root_page=homepage, is_default_site=True)
def remove_homepage(apps, schema_editor):
# Get models
ContentType = apps.get_model("contenttypes.ContentType")
HomePage = apps.get_model("home.HomePage")
# Delete the default homepage
# Page and Site objects CASCADE
HomePage.objects.filter(slug="home", depth=2).delete()
# Delete content type for homepage model
ContentType.objects.filter(model="homepage", app_label="home").delete()
class Migration(migrations.Migration):
run_before = [
("wagtailcore", "0053_locale_model"),
]
dependencies = [
("home", "0001_initial"),
]
operations = [
migrations.RunPython(create_homepage, remove_homepage),
]
# Generated by Django 4.2.2 on 2023-07-23 12:29
from django.db import migrations, models
import django.db.models.deletion
import wagtail.fields
class Migration(migrations.Migration):
dependencies = [
('wagtailcore', '0083_workflowcontenttype'),
('home', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='HomeArticlePage',
fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.page')),
('author', models.CharField(verbose_name='Autor')),
('perex', wagtail.fields.RichTextField(verbose_name='Perex')),
('content', wagtail.fields.RichTextField(verbose_name='Obsah')),
],
options={
'abstract': False,
},
bases=('wagtailcore.page',),
),
migrations.RemoveField(
model_name='homearticlespage',
name='author',
),
migrations.RemoveField(
model_name='homearticlespage',
name='perex',
),
]
# Generated by Django 4.2.2 on 2023-07-18 13:28
# Generated by Django 4.2.2 on 2023-07-23 12:31
import wagtail.fields
from django.db import migrations
import wagtail.fields
class Migration(migrations.Migration):
dependencies = [
("home", "0009_alter_homepage_events"),
('home', '0002_homearticlepage_remove_homearticlespage_author_and_more'),
]
operations = [
migrations.AddField(
model_name="homepage",
name="heading_text",
field=wagtail.fields.RichTextField(
default="", verbose_name="Hlavní text stránky"
),
preserve_default=False,
migrations.AlterField(
model_name='homearticlespage',
name='content',
field=wagtail.fields.RichTextField(blank=True, null=True, verbose_name='Obsah'),
),
]
# Generated by Django 4.2.2 on 2023-06-29 13:26
import wagtail.blocks
import wagtail.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("home", "0002_create_homepage"),
]
operations = [
migrations.AddField(
model_name="homepage",
name="controller",
field=wagtail.fields.StreamField(
[
(
"person",
wagtail.blocks.StructBlock(
[
("name", wagtail.blocks.CharBlock(label="Jméno")),
(
"position",
wagtail.blocks.TextBlock(label="Pracovní pozice"),
),
(
"email",
wagtail.blocks.EmailBlock(label="E-mailová adresa"),
),
]
),
)
],
blank=True,
null=True,
use_json_field=True,
verbose_name="Kontrolor",
),
),
migrations.AddField(
model_name="homepage",
name="council_members",
field=wagtail.fields.StreamField(
[
(
"person",
wagtail.blocks.StructBlock(
[
("name", wagtail.blocks.CharBlock(label="Jméno")),
(
"position",
wagtail.blocks.TextBlock(label="Pracovní pozice"),
),
(
"email",
wagtail.blocks.EmailBlock(label="E-mailová adresa"),
),
]
),
)
],
blank=True,
null=True,
use_json_field=True,
verbose_name="Správní rada",
),
),
migrations.AddField(
model_name="homepage",
name="director",
field=wagtail.fields.StreamField(
[
(
"person",
wagtail.blocks.StructBlock(
[
("name", wagtail.blocks.CharBlock(label="Jméno")),
(
"position",
wagtail.blocks.TextBlock(label="Pracovní pozice"),
),
(
"email",
wagtail.blocks.EmailBlock(label="E-mailová adresa"),
),
]
),
)
],
blank=True,
null=True,
use_json_field=True,
verbose_name="Ředitel",
),
),
migrations.AddField(
model_name="homepage",
name="employees",
field=wagtail.fields.StreamField(
[
(
"person",
wagtail.blocks.StructBlock(
[
("name", wagtail.blocks.CharBlock(label="Jméno")),
(
"position",
wagtail.blocks.TextBlock(label="Pracovní pozice"),
),
(
"email",
wagtail.blocks.EmailBlock(label="E-mailová adresa"),
),
]
),
)
],
blank=True,
null=True,
use_json_field=True,
verbose_name="Zaměstnanci",
),
),
migrations.AddField(
model_name="homepage",
name="volunteers",
field=wagtail.fields.StreamField(
[
(
"person",
wagtail.blocks.StructBlock(
[
("name", wagtail.blocks.CharBlock(label="Jméno")),
(
"position",
wagtail.blocks.TextBlock(label="Pracovní pozice"),
),
(
"email",
wagtail.blocks.EmailBlock(label="E-mailová adresa"),
),
]
),
)
],
blank=True,
null=True,
use_json_field=True,
verbose_name="Dobrovolníci",
),
),
]
# Generated by Django 4.2.2 on 2023-06-29 13:39
import wagtail.blocks
import wagtail.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("home", "0003_homepage_controller_homepage_council_members_and_more"),
]
operations = [
migrations.AlterField(
model_name="homepage",
name="controller",
field=wagtail.fields.StreamField(
[
(
"person",
wagtail.blocks.StructBlock(
[
("name", wagtail.blocks.CharBlock(label="Jméno")),
(
"position",
wagtail.blocks.TextBlock(
blank=True, label="Pracovní pozice", null=True
),
),
(
"email",
wagtail.blocks.EmailBlock(
blank=True, label="E-mailová adresa", null=True
),
),
]
),
)
],
blank=True,
null=True,
use_json_field=True,
verbose_name="Kontrolor",
),
),
migrations.AlterField(
model_name="homepage",
name="council_members",
field=wagtail.fields.StreamField(
[
(
"person",
wagtail.blocks.StructBlock(
[
("name", wagtail.blocks.CharBlock(label="Jméno")),
(
"position",
wagtail.blocks.TextBlock(
blank=True, label="Pracovní pozice", null=True
),
),
(
"email",
wagtail.blocks.EmailBlock(
blank=True, label="E-mailová adresa", null=True
),
),
]
),
)
],
blank=True,
null=True,
use_json_field=True,
verbose_name="Správní rada",
),
),
migrations.AlterField(
model_name="homepage",
name="director",
field=wagtail.fields.StreamField(
[
(
"person",
wagtail.blocks.StructBlock(
[
("name", wagtail.blocks.CharBlock(label="Jméno")),
(
"position",
wagtail.blocks.TextBlock(
blank=True, label="Pracovní pozice", null=True
),
),
(
"email",
wagtail.blocks.EmailBlock(
blank=True, label="E-mailová adresa", null=True
),
),
]
),
)
],
blank=True,
null=True,
use_json_field=True,
verbose_name="Ředitel",
),
),
migrations.AlterField(
model_name="homepage",
name="employees",
field=wagtail.fields.StreamField(
[
(
"person",
wagtail.blocks.StructBlock(
[
("name", wagtail.blocks.CharBlock(label="Jméno")),
(
"position",
wagtail.blocks.TextBlock(
blank=True, label="Pracovní pozice", null=True
),
),
(
"email",
wagtail.blocks.EmailBlock(
blank=True, label="E-mailová adresa", null=True
),
),
]
),
)
],
blank=True,
null=True,
use_json_field=True,
verbose_name="Zaměstnanci",
),
),
migrations.AlterField(
model_name="homepage",
name="volunteers",
field=wagtail.fields.StreamField(
[
(
"person",
wagtail.blocks.StructBlock(
[
("name", wagtail.blocks.CharBlock(label="Jméno")),
(
"position",
wagtail.blocks.TextBlock(
blank=True, label="Pracovní pozice", null=True
),
),
(
"email",
wagtail.blocks.EmailBlock(
blank=True, label="E-mailová adresa", null=True
),
),
]
),
)
],
blank=True,
null=True,
use_json_field=True,
verbose_name="Dobrovolníci",
),
),
]
# Generated by Django 4.2.2 on 2023-07-23 12:37
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('home', '0003_alter_homearticlespage_content'),
]
operations = [
migrations.AddField(
model_name='homearticlepage',
name='date',
field=models.DateField(default=django.utils.timezone.now, verbose_name='Datum vytvoření'),
),
]
# Generated by Django 4.2.2 on 2023-06-29 13:58
import wagtail.blocks
import wagtail.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("home", "0004_alter_homepage_controller_and_more"),
]
operations = [
migrations.AddField(
model_name="homepage",
name="address",
field=models.CharField(default="", verbose_name="Sídlo"),
preserve_default=False,
),
migrations.AddField(
model_name="homepage",
name="branch",
field=models.CharField(default="", verbose_name="Pobočka"),
preserve_default=False,
),
migrations.AddField(
model_name="homepage",
name="ds_id",
field=models.CharField(default="", verbose_name="Datová schránka"),
preserve_default=False,
),
migrations.AddField(
model_name="homepage",
name="email",
field=models.EmailField(default="", max_length=254, verbose_name="Email"),
preserve_default=False,
),
migrations.AlterField(
model_name="homepage",
name="controller",
field=wagtail.fields.StreamField(
[
(
"person",
wagtail.blocks.StructBlock(
[
("name", wagtail.blocks.CharBlock(label="Jméno")),
(
"position",
wagtail.blocks.TextBlock(
label="Pracovní pozice", required=False
),
),
(
"email",
wagtail.blocks.EmailBlock(
label="E-mailová adresa", required=False
),
),
]
),
)
],
blank=True,
null=True,
use_json_field=True,
verbose_name="Kontrolor",
),
),
migrations.AlterField(
model_name="homepage",
name="council_members",
field=wagtail.fields.StreamField(
[
(
"person",
wagtail.blocks.StructBlock(
[
("name", wagtail.blocks.CharBlock(label="Jméno")),
(
"position",
wagtail.blocks.TextBlock(
label="Pracovní pozice", required=False
),
),
(
"email",
wagtail.blocks.EmailBlock(
label="E-mailová adresa", required=False
),
),
]
),
)
],
blank=True,
null=True,
use_json_field=True,
verbose_name="Správní rada",
),
),
migrations.AlterField(
model_name="homepage",
name="director",
field=wagtail.fields.StreamField(
[
(
"person",
wagtail.blocks.StructBlock(
[
("name", wagtail.blocks.CharBlock(label="Jméno")),
(
"position",
wagtail.blocks.TextBlock(
label="Pracovní pozice", required=False
),
),
(
"email",
wagtail.blocks.EmailBlock(
label="E-mailová adresa", required=False
),
),
]
),
)
],
blank=True,
null=True,
use_json_field=True,
verbose_name="Ředitel",
),
),
migrations.AlterField(
model_name="homepage",
name="employees",
field=wagtail.fields.StreamField(
[
(
"person",
wagtail.blocks.StructBlock(
[
("name", wagtail.blocks.CharBlock(label="Jméno")),
(
"position",
wagtail.blocks.TextBlock(
label="Pracovní pozice", required=False
),
),
(
"email",
wagtail.blocks.EmailBlock(
label="E-mailová adresa", required=False
),
),
]
),
)
],
blank=True,
null=True,
use_json_field=True,
verbose_name="Zaměstnanci",
),
),
migrations.AlterField(
model_name="homepage",
name="volunteers",
field=wagtail.fields.StreamField(
[
(
"person",
wagtail.blocks.StructBlock(
[
("name", wagtail.blocks.CharBlock(label="Jméno")),
(
"position",
wagtail.blocks.TextBlock(
label="Pracovní pozice", required=False
),
),
(
"email",
wagtail.blocks.EmailBlock(
label="E-mailová adresa", required=False
),
),
]
),
)
],
blank=True,
null=True,
use_json_field=True,
verbose_name="Dobrovolníci",
),
),
]
# Generated by Django 4.2.2 on 2023-07-23 13:41
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0004_homearticlepage_date'),
]
operations = [
migrations.CreateModel(
name='Tag',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(verbose_name='Jméno')),
],
options={
'verbose_name': 'Štítek',
'verbose_name_plural': 'Štítky',
},
),
migrations.AlterModelOptions(
name='homearticlepage',
options={'ordering': ['-date']},
),
migrations.AlterField(
model_name='homearticlepage',
name='perex',
field=models.TextField(verbose_name='Perex'),
),
migrations.AddField(
model_name='homearticlepage',
name='tags',
field=models.ManyToManyField(to='home.tag', verbose_name='Štítky'),
),
]
# Generated by Django 4.2.2 on 2023-07-18 11:06
import wagtail.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("home", "0005_homepage_address_homepage_branch_homepage_ds_id_and_more"),
]
operations = [
migrations.AddField(
model_name="homepage",
name="donation_text",
field=wagtail.fields.RichTextField(
default="", verbose_name="Text pro dary"
),
preserve_default=False,
),
]
# Generated by Django 4.2.2 on 2023-07-18 11:21
import wagtail.blocks
import wagtail.documents.blocks
import wagtail.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("home", "0006_homepage_donation_text"),
]
operations = [
migrations.AddField(
model_name="homepage",
name="documents",
field=wagtail.fields.StreamField(
[
(
"document",
wagtail.blocks.StructBlock(
[
("name", wagtail.blocks.CharBlock(label="Jméno")),
(
"date_added",
wagtail.blocks.DateBlock(label="Datum přidání"),
),
(
"file",
wagtail.documents.blocks.DocumentChooserBlock(
label="Dokument"
),
),
]
),
)
],
blank=True,
null=True,
use_json_field=True,
verbose_name="Dokumenty",
),
),
]
# Generated by Django 4.2.2 on 2023-07-18 12:41
import wagtail.blocks
import wagtail.documents.blocks
import wagtail.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("home", "0007_homepage_documents"),
]
operations = [
migrations.AddField(
model_name="homepage",
name="events",
field=wagtail.fields.StreamField(
[
(
"event",
wagtail.blocks.StructBlock(
[
("name", wagtail.blocks.CharBlock(label="Jméno")),
(
"date_ran",
wagtail.blocks.DateBlock(
label="Datum konání", required=False
),
),
(
"location",
wagtail.blocks.CharBlock(
label="Lokace", required=False
),
),
]
),
)
],
blank=True,
null=True,
use_json_field=True,
verbose_name="Události",
),
),
migrations.AlterField(
model_name="homepage",
name="documents",
field=wagtail.fields.StreamField(
[
(
"document",
wagtail.blocks.StructBlock(
[
("name", wagtail.blocks.CharBlock(label="Jméno")),
(
"date_added",
wagtail.blocks.DateBlock(
label="Datum přidání", required=False
),
),
(
"url",
wagtail.blocks.URLBlock(
label="URL (místo dokumentu)", required=False
),
),
(
"file",
wagtail.documents.blocks.DocumentChooserBlock(
label="Dokument", required=False
),
),
]
),
)
],
blank=True,
null=True,
use_json_field=True,
verbose_name="Dokumenty",
),
),
]
# Generated by Django 4.2.2 on 2023-07-18 13:08
import wagtail.blocks
import wagtail.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("home", "0008_homepage_events_alter_homepage_documents"),
]
operations = [
migrations.AlterField(
model_name="homepage",
name="events",
field=wagtail.fields.StreamField(
[
(
"event",
wagtail.blocks.StructBlock(
[
("name", wagtail.blocks.CharBlock(label="Jméno")),
(
"date",
wagtail.blocks.DateBlock(
label="Datum konání", required=False
),
),
(
"location",
wagtail.blocks.CharBlock(
label="Lokace", required=False
),
),
]
),
)
],
blank=True,
null=True,
use_json_field=True,
verbose_name="Události",
),
),
]
from django.db import models
from django.utils import timezone
from wagtail.admin.panels import FieldPanel
from wagtail.fields import RichTextField, StreamField
from wagtail.models import Page
......@@ -82,6 +83,10 @@ class HomePage(Page):
null=True,
)
subpage_types = [
"home.HomeArticlesPage"
]
content_panels = Page.content_panels + [
FieldPanel("heading_text", icon="pilcrow"),
FieldPanel("events", icon="calendar-alt"),
......@@ -97,3 +102,92 @@ class HomePage(Page):
FieldPanel("volunteers", icon="group"),
FieldPanel("employees", icon="group"),
]
@property
def articles_page(self) -> "HomeArticlesPage":
return (
HomeArticlesPage
.objects
.live()
.first()
)
@property
def latest_articles(self):
return (
HomeArticlePage
.objects
.live()
.all()
[:3]
)
class HomeArticlesPage(Page):
content = RichTextField(verbose_name="Obsah", blank=True, null=True)
parent_page_type = [
"home.HomePage"
]
subpage_types = [
"home.HomeArticlePage"
]
content_panels = Page.content_panels + [
FieldPanel("content", icon="pilcrow"),
]
@property
def articles(self):
return (
HomeArticlePage
.objects
.live()
.all()
)
class HomeArticlePage(Page):
tags = models.ManyToManyField(
"Tag",
verbose_name="Štítky"
)
author = models.CharField(verbose_name="Autor")
date = models.DateField(
verbose_name="Datum vytvoření",
default=timezone.now
)
perex = models.TextField(verbose_name="Perex")
content = RichTextField(verbose_name="Obsah")
parent_page_type = [
"home.HomeArticlesPage"
]
content_panels = Page.content_panels + [
FieldPanel("author", icon="user"),
FieldPanel("date", icon="calendar"),
FieldPanel("perex", icon="pilcrow"),
FieldPanel("content", icon="pilcrow"),
]
@property
def shortened_perex(self) -> str:
if len(self.perex) > 310:
return self.perex[:300] + "..."
return self.perex
class Meta:
ordering = ["-date"]
class Tag(models.Model):
name = models.CharField(verbose_name="Jméno")
class Meta:
verbose_name = "Štítek"
verbose_name_plural = "Štítky"
<li>
<a
href="{% if self.url %}{{ self.url }}{% else %}{{ self.document.url }}{% endif %}"
href="{% if self.url %}{{ self.url }}{% else %}{{ self.file.url }}{% endif %}"
target="_blank"
>
<h3 class="font-serif leading-4">
......
<a href="{{ self.url }}" target="_blank">
<li class="flex flex-col">
{% if self.date or self.location %}
<small class="text-pii-cyan uppercase">
{{ self.date.day }}. {{ self.date.month }}. {{ self.date.year }}&nbsp;|&nbsp;{{ self.location }}
{% if self.date %}
{{ self.date.day }}. {{ self.date.month }}. {{ self.date.year }}
{% endif %}
{% if self.location %}
{% if self.date %}
&nbsp;|&nbsp;
{% endif %}
{{ self.location }}
{% endif %}
</small>
{% endif %}
<span
class="font-bold font-serif text-xl"
......
<li>
<div class="flex gap-2">
{% if self.email %}
<a class="flex gap-2" href="mailto:{{ self.email }}">
{% endif %}
{% if self.position %}
<strong>{{ self.name }}</strong>
{% else %}
......@@ -7,8 +11,9 @@
{% endif %}
{% if self.email %}
<a href="mailto:{{ self.email }}" class="flex items-center">
<div class="flex items-center">
<i class="ico--at text-xl text-pii-cyan"></i>
</div>
</a>
{% endif %}
</div>
......
{% extends "base.html" %}
{% load static wagtailcore_tags %}
{% block content %}
<main class="flex flex-col items-center gap-10 pt-14">
<div class="container">
<h1 class="font-bebas text-4xl">{{ page.title }}</h1>
<small class="flex gap-2">
<div>{{ page.date }}</div>
{% if page.author %}
<div>| {{ page.author }}</div>
{% endif %}
</small>
<div class="mt-5 prose max-w-screen-md font-serif">
<p class="mb-3">{{ page.perex }}</p>
{{ page.content|richtext }}
</div>
</div>
</main>
{% endblock content %}
{% extends "base.html" %}
{% load static wagtailcore_tags %}
{% block content %}
<main class="flex flex-col items-center gap-10 pt-14">
<div class="container">
<ul class="flex gap-4 lg:h-96 lg:flex-nowrap flex-wrap">
{% for article in page.articles %}
<li class="bg-pii-cyan text-white p-7 lg:w-80">
<a
class="flex flex-col gap-2 h-full"
href="{{ article.url }}"
>
<small class="text-pii-cyan uppercase font-bold">
{% for tag in article.tags.all %}
{{ tag.name }}
{% endfor %}
</small>
<h3 class="font-serif text-xl leading-6 font-bold">{{ article.title }}</h3>
<p class="font-serif leading-5 grow">
{{ article.shortened_perex }}
</p>
<small class="font-serif">
Přidáno {{ article.date }}
</small>
</a>
</li>
{% endfor %}
</ul>
</div>
</main>
{% endblock content %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment