Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • feat-more-blocks
  • feat-rework-election-page
  • feat/custom-css
  • feat/dary-improvements
  • feat/geo-feature-collections
  • feat/hideable-tweets
  • feat/instagram-feed
  • feat/people-octopus-imports
  • feat/pirstan-changes
  • feat/redesign-fixes-3
  • feat/redesign-improvements-10
  • feat/redesign-improvements-8
  • feat/separate-import-thread
  • feature/crypto-widget
  • features/add-custom-numbering-for-candidates
  • features/add-dynamic-candidate-numbers
  • features/add-embed-to-articles
  • features/add-feature-enlarging-sub-block
  • features/add-link-to-images
  • features/add-pdf-page
  • features/add-redirects
  • features/add-thumbnail-principle-to-uniweb-and-senate
  • features/add-timeline
  • features/add-typed-table
  • features/create-collapsible-extra-legal-info
  • features/create-mastodon-feed-block
  • features/create-wordcloud-from-article-page
  • features/donation-panel-should-be-optional
  • features/extend-hero-banner
  • features/fix-broken-calendar-categories
  • master
  • test
32 results

Target

Select target project
  • to/majak
  • b1242/majak
2 results
Select Git revision
  • fix1
  • localwebs
  • master
  • pdp
  • seo1
  • target-groups
  • test
7 results
Show changes
Showing
with 1726 additions and 0 deletions
# Generated by Django 3.2.11 on 2022-03-03 11:17
import wagtail.blocks
import wagtail.contrib.table_block.blocks
import wagtail.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("district", "0038_auto_20220303_1107"),
]
operations = [
migrations.AlterField(
model_name="districtcustompage",
name="content",
field=wagtail.fields.StreamField(
[
("text", wagtail.blocks.RichTextBlock()),
("table", wagtail.contrib.table_block.blocks.TableBlock()),
],
blank=True,
verbose_name="Obsah",
),
),
]
# Generated by Django 3.2.11 on 2022-03-09 08:35
import wagtail.blocks
import wagtail.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("district", "0039_alter_districtcustompage_content"),
]
operations = [
migrations.AddField(
model_name="districthomepage",
name="menu",
field=wagtail.fields.StreamField(
[
(
"menu_item",
wagtail.blocks.StructBlock(
[
(
"title",
wagtail.blocks.CharBlock(
label="Titulek", required=True
),
),
(
"page",
wagtail.blocks.PageChooserBlock(
label="Stránka", required=False
),
),
(
"link",
wagtail.blocks.URLBlock(
label="Odkaz", required=False
),
),
]
),
),
(
"menu_parent",
wagtail.blocks.StructBlock(
[
(
"title",
wagtail.blocks.CharBlock(
label="Titulek", required=True
),
),
(
"menu_items",
wagtail.blocks.ListBlock(
wagtail.blocks.StructBlock(
[
(
"title",
wagtail.blocks.CharBlock(
label="Titulek", required=True
),
),
(
"page",
wagtail.blocks.PageChooserBlock(
label="Stránka", required=False
),
),
(
"link",
wagtail.blocks.URLBlock(
label="Odkaz", required=False
),
),
]
)
),
),
]
),
),
],
blank=True,
verbose_name="Menu",
),
),
]
# Generated by Django 3.2.11 on 2022-03-09 10:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("district", "0040_districthomepage_menu"),
]
operations = [
migrations.AddField(
model_name="districtpersonpage",
name="custom_web_url",
field=models.URLField(
blank=True, null=True, verbose_name="Odkaz na vlastní web"
),
),
migrations.AlterField(
model_name="districtpersonpage",
name="job",
field=models.CharField(
blank=True,
help_text="Např. 'Informatik'",
max_length=128,
null=True,
verbose_name="Povolání",
),
),
migrations.AlterField(
model_name="districtpersonpage",
name="job_function",
field=models.CharField(
blank=True,
help_text="Např. 'Předseda'",
max_length=128,
null=True,
verbose_name="Funkce",
),
),
]
# Generated by Django 3.2.11 on 2022-03-09 12:19
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("district", "0041_auto_20220309_1109"),
]
operations = [
migrations.AddField(
model_name="districtpersonpage",
name="show_email",
field=models.BooleanField(
default=True, verbose_name="Zobrazovat email na stránce?"
),
),
migrations.AlterField(
model_name="districtpersonpage",
name="email",
field=models.EmailField(max_length=254, null=True, verbose_name="Email"),
),
]
# Generated by Django 4.0.3 on 2022-03-11 22:09
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("taggit", "0004_alter_taggeditem_content_type_alter_taggeditem_tag"),
("district", "0042_auto_20220309_1319"),
]
operations = [
migrations.AlterField(
model_name="districtarticletag",
name="tag",
field=models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="%(app_label)s_%(class)s_items",
to="taggit.tag",
),
),
migrations.AlterField(
model_name="districtpersontag",
name="tag",
field=models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="%(app_label)s_%(class)s_items",
to="taggit.tag",
),
),
]
# Generated by Django 4.0.3 on 2022-03-18 09:33
# -*- coding: utf-8 -*-
import json
import wagtail.blocks
import wagtail.fields
from django.core.serializers.json import DjangoJSONEncoder
from django.db import migrations
from wagtail.rich_text import RichText
def page_to_streamfield(page):
changed = False
if page.text and not page.content:
page.content = [("text", RichText(page.text))]
changed = True
return page, changed
def pagerevision_to_streamfield(revision_data):
changed = False
body = revision_data.get("text")
if body:
try:
json.loads(body)
except ValueError:
revision_data["content"] = json.dumps(
[{"value": body, "type": "text"}], cls=DjangoJSONEncoder
)
changed = True
else:
# It's already valid JSON. Leave it.
pass
return revision_data, changed
def page_to_richtext(page):
changed = False
if page.content.raw_text is None:
raw_text = "".join(
[child.value.source for child in page.content if child.block_type == "text"]
)
page.text = raw_text
changed = True
return page, changed
def pagerevision_to_richtext(revision_data):
changed = False
body = revision_data.get("content", "definitely non-JSON string")
if body:
try:
body_data = json.loads(body)
except ValueError:
# It's not apparently a StreamField. Leave it.
pass
else:
raw_text = "".join(
[child["value"] for child in body_data if child["type"] == "text"]
)
revision_data["text"] = raw_text
changed = True
return revision_data, changed
def convert(apps, schema_editor, page_converter, pagerevision_converter):
DistrictArticlePage = apps.get_model("district", "DistrictArticlePage")
for page in DistrictArticlePage.objects.all():
page, changed = page_converter(page)
if changed:
page.save()
for revision in page.revisions.all():
revision_data = json.loads(revision.content_json)
revision_data, changed = pagerevision_converter(revision_data)
if changed:
revision.content_json = json.dumps(revision_data, cls=DjangoJSONEncoder)
revision.save()
def convert_to_streamfield(apps, schema_editor):
return convert(
apps, schema_editor, page_to_streamfield, pagerevision_to_streamfield
)
def convert_to_richtext(apps, schema_editor):
return convert(apps, schema_editor, page_to_richtext, pagerevision_to_richtext)
class Migration(migrations.Migration):
dependencies = [
("district", "0043_alter_districtarticletag_tag_and_more"),
]
operations = [
migrations.AddField(
model_name="districtarticlepage",
name="content",
field=wagtail.fields.StreamField(
[
(
"text",
wagtail.blocks.RichTextBlock(
features=[
"h2",
"h3",
"h4",
"bold",
"italic",
"ol",
"ul",
"link",
"document-link",
"image",
],
label="Textový editor",
),
)
],
blank=True,
verbose_name="Článek",
),
),
migrations.RunPython(
convert_to_streamfield,
convert_to_richtext,
),
migrations.RemoveField(
model_name="districtarticlepage",
name="text",
),
]
# Generated by Django 4.0.3 on 2022-03-18 14:13
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("wagtailimages", "0023_add_choose_permissions"),
("district", "0044_remove_districtarticlepage_text_and_more"),
]
operations = [
migrations.AddField(
model_name="districthomepage",
name="custom_logo",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="wagtailimages.image",
),
),
migrations.AddField(
model_name="districthomepage",
name="flickr",
field=models.URLField(
blank=True,
default="https://www.flickr.com/photos/pirati/",
null=True,
verbose_name="Flickr URL",
),
),
migrations.AddField(
model_name="districthomepage",
name="instagram",
field=models.URLField(
blank=True,
default="https://www.instagram.com/pirati.cz/",
null=True,
verbose_name="Instagram URL",
),
),
migrations.AddField(
model_name="districthomepage",
name="show_eshop_link",
field=models.BooleanField(
default=True, verbose_name="Zobrazit v záhlaví odkaz na pirátský eshop"
),
),
migrations.AddField(
model_name="districthomepage",
name="show_magazine_link",
field=models.BooleanField(
default=True, verbose_name="Zobrazit v záhlaví odkaz na pirátské listy"
),
),
migrations.AddField(
model_name="districthomepage",
name="show_pirati_cz_link",
field=models.BooleanField(
default=True, verbose_name="Zobrazit v záhlaví odkaz 'pirati.cz'"
),
),
migrations.AlterField(
model_name="districthomepage",
name="contact_newcomers",
field=models.URLField(
blank=True,
default="https://nalodeni.pirati.cz",
null=True,
verbose_name="URL pro zájemce o členství",
),
),
migrations.AlterField(
model_name="districthomepage",
name="donation_page",
field=models.URLField(
blank=True,
default="https://dary.pirati.cz",
null=True,
verbose_name="URL pro příjem darů (tlačítko Přispěj)",
),
),
migrations.AlterField(
model_name="districthomepage",
name="facebook",
field=models.URLField(
blank=True,
default="https://www.facebook.com/ceska.piratska.strana",
null=True,
verbose_name="Facebook URL",
),
),
migrations.AlterField(
model_name="districthomepage",
name="forum",
field=models.URLField(
blank=True,
default="https://forum.pirati.cz/",
null=True,
verbose_name="Fórum URL",
),
),
migrations.AlterField(
model_name="districthomepage",
name="twitter",
field=models.URLField(
blank=True,
default="https://www.twitter.com/PiratskaStrana",
null=True,
verbose_name="Twitter URL",
),
),
migrations.AlterField(
model_name="districthomepage",
name="youtube",
field=models.URLField(
blank=True,
default="https://www.youtube.com/channel/UC_zxYLGrkmrYazYt0MzyVlA",
null=True,
verbose_name="YouTube URL",
),
),
]
# Generated by Django 4.0.3 on 2022-03-23 09:24
import wagtail.blocks
import wagtail.contrib.table_block.blocks
import wagtail.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
(
"district",
"0045_districthomepage_custom_logo_districthomepage_flickr_and_more",
),
]
operations = [
migrations.AddField(
model_name="districtcenterpage",
name="content",
field=wagtail.fields.StreamField(
[
("text", wagtail.blocks.RichTextBlock()),
("table", wagtail.contrib.table_block.blocks.TableBlock()),
],
blank=True,
verbose_name="Obsah",
),
),
]
# Generated by Django 4.0.3 on 2022-03-25 09:33
import wagtail.blocks
import wagtail.contrib.table_block.blocks
import wagtail.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("district", "0046_districtcenterpage_content"),
]
operations = [
migrations.AddField(
model_name="districtcrossroadpage",
name="content",
field=wagtail.fields.StreamField(
[
(
"people_group",
wagtail.blocks.StructBlock(
[
(
"group_title",
wagtail.blocks.CharBlock(
label="Titulek", required=True
),
),
(
"person_list",
wagtail.blocks.ListBlock(
wagtail.blocks.PageChooserBlock(
label="Osoba",
page_type=["district.DistrictPersonPage"],
),
label="List osob",
),
),
]
),
)
],
blank=True,
verbose_name="Obsah stránky",
),
),
migrations.AlterField(
model_name="districtcustompage",
name="content",
field=wagtail.fields.StreamField(
[
("text", wagtail.blocks.RichTextBlock()),
("table", wagtail.contrib.table_block.blocks.TableBlock()),
(
"people_group",
wagtail.blocks.StructBlock(
[
(
"group_title",
wagtail.blocks.CharBlock(
label="Titulek", required=True
),
),
(
"person_list",
wagtail.blocks.ListBlock(
wagtail.blocks.PageChooserBlock(
label="Osoba",
page_type=["district.DistrictPersonPage"],
),
label="List osob",
),
),
]
),
),
],
blank=True,
verbose_name="Obsah",
),
),
]
# Generated by Django 4.0.3 on 2022-03-25 09:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("district", "0047_districtcrossroadpage_content_and_more"),
]
operations = [
migrations.AddField(
model_name="districthomepage",
name="footperson_coord_title",
field=models.CharField(
default="Koordinátor", max_length=128, verbose_name="Název funkce"
),
),
migrations.AddField(
model_name="districthomepage",
name="footperson_electman_title",
field=models.CharField(
default="Volební manažer", max_length=128, verbose_name="Název funkce"
),
),
migrations.AddField(
model_name="districthomepage",
name="footperson_media_title",
field=models.CharField(
default="Kontakt pro média", max_length=128, verbose_name="Název funkce"
),
),
]
# Generated by Django 4.0.3 on 2022-04-01 10:21
import wagtail.blocks
import wagtail.fields
import wagtail.images.blocks
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("district", "0048_districthomepage_footperson_coord_title_and_more"),
]
operations = [
migrations.AlterField(
model_name="districtcrossroadpage",
name="cards_content",
field=wagtail.fields.StreamField(
[
(
"cards",
wagtail.blocks.StructBlock(
[
(
"headline",
wagtail.blocks.CharBlock(
label="Titulek bloku", required=False
),
),
(
"card_items",
wagtail.blocks.ListBlock(
wagtail.blocks.StructBlock(
[
(
"image",
wagtail.images.blocks.ImageChooserBlock(
label="Obrázek"
),
),
(
"title",
wagtail.blocks.CharBlock(
label="Titulek", required=True
),
),
(
"page",
wagtail.blocks.PageChooserBlock(
label="Stránka",
page_type=[
# "district.DistrictAfterElectionPage",
"district.DistrictArticlePage",
"district.DistrictArticlesPage",
"district.DistrictCenterPage",
"district.DistrictContactPage",
"district.DistrictCrossroadPage",
"district.DistrictCustomPage",
# "district.DistrictElectionPage",
# "district.DistrictElectionPointPage",
"district.DistrictPeoplePage",
"district.DistrictPersonPage",
# "district.DistrictProgramPage",
# "district.DistrictTagsPage",
],
required=False,
),
),
(
"link",
wagtail.blocks.URLBlock(
label="Odkaz", required=False
),
),
]
),
label="Karty odkazu",
),
),
]
),
)
],
blank=True,
verbose_name="Karty rozcestníku",
),
),
]
# Generated by Django 4.0.3 on 2022-04-01 11:30
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("district", "0048_districthomepage_footperson_coord_title_and_more"),
]
operations = [
migrations.AddField(
model_name="districtarticlespage",
name="last_import_log",
field=models.TextField(
blank=True, null=True, verbose_name="Výstup z posledního importu"
),
),
]
# Generated by Django 4.0.3 on 2022-04-01 10:49
import wagtail.blocks
import wagtail.contrib.table_block.blocks
import wagtail.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("district", "0049_alter_districtcrossroadpage_cards_content"),
]
operations = [
migrations.AlterField(
model_name="districtcrossroadpage",
name="content",
field=wagtail.fields.StreamField(
[
(
"people_group",
wagtail.blocks.StructBlock(
[
(
"group_title",
wagtail.blocks.CharBlock(
label="Titulek", required=True
),
),
(
"person_list",
wagtail.blocks.ListBlock(
wagtail.blocks.PageChooserBlock(
label="Osoba",
page_type=[
"district.DistrictPersonPage",
],
),
label="List osob",
),
),
]
),
)
],
blank=True,
verbose_name="Obsah stránky",
),
),
migrations.AlterField(
model_name="districtcustompage",
name="content",
field=wagtail.fields.StreamField(
[
("text", wagtail.blocks.RichTextBlock()),
("table", wagtail.contrib.table_block.blocks.TableBlock()),
(
"people_group",
wagtail.blocks.StructBlock(
[
(
"group_title",
wagtail.blocks.CharBlock(
label="Titulek", required=True
),
),
(
"person_list",
wagtail.blocks.ListBlock(
wagtail.blocks.PageChooserBlock(
label="Osoba",
page_type=[
"district.DistrictPersonPage",
],
),
label="List osob",
),
),
]
),
),
],
blank=True,
verbose_name="Obsah",
),
),
migrations.AlterField(
model_name="districtpeoplepage",
name="content",
field=wagtail.fields.StreamField(
[
(
"people_group",
wagtail.blocks.StructBlock(
[
(
"group_title",
wagtail.blocks.CharBlock(
label="Titulek", required=True
),
),
(
"person_list",
wagtail.blocks.ListBlock(
wagtail.blocks.PageChooserBlock(
label="Osoba",
page_type=[
"district.DistrictPersonPage",
],
),
label="List osob",
),
),
]
),
)
],
blank=True,
verbose_name="Obsah stránky",
),
),
]
# Generated by Django 4.0.3 on 2022-04-01 14:55
import wagtail.blocks
import wagtail.fields
import wagtail.images.blocks
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("district", "0050_alter_districtcrossroadpage_content_and_more"),
]
operations = [
migrations.AlterField(
model_name="districtarticlepage",
name="content",
field=wagtail.fields.StreamField(
[
(
"text",
wagtail.blocks.RichTextBlock(
features=[
"h2",
"h3",
"h4",
"bold",
"italic",
"ol",
"embed",
"ul",
"link",
"document-link",
"image",
],
label="Textový editor",
),
),
(
"gallery",
wagtail.blocks.StructBlock(
[
(
"gallery_items",
wagtail.blocks.ListBlock(
wagtail.images.blocks.ImageChooserBlock(
label="obrázek", required=True
),
group="ostatní",
icon="image",
label="Galerie",
),
)
],
label="Galerie",
),
),
],
blank=True,
verbose_name="Článek",
),
),
]
# Generated by Django 4.0.3 on 2022-04-04 13:39
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("district", "0049_districtarticlespage_last_import_log"),
("district", "0051_alter_districtarticlepage_content"),
]
operations = []
# Generated by Django 4.0.3 on 2022-04-14 12:31
import wagtail.blocks
import wagtail.fields
import wagtail.images.blocks
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("district", "0052_merge_20220404_1539"),
]
operations = [
migrations.AlterField(
model_name="districtcrossroadpage",
name="cards_content",
field=wagtail.fields.StreamField(
[
(
"cards",
wagtail.blocks.StructBlock(
[
(
"headline",
wagtail.blocks.CharBlock(
label="Titulek bloku", required=False
),
),
(
"card_items",
wagtail.blocks.ListBlock(
wagtail.blocks.StructBlock(
[
(
"image",
wagtail.images.blocks.ImageChooserBlock(
label="Obrázek"
),
),
(
"title",
wagtail.blocks.CharBlock(
label="Titulek", required=True
),
),
(
"text",
wagtail.blocks.RichTextBlock(
label="Krátký text pod nadpisem",
required=False,
),
),
(
"page",
wagtail.blocks.PageChooserBlock(
label="Stránka",
page_type=[
# "district.DistrictAfterElectionPage",
"district.DistrictArticlePage",
"district.DistrictArticlesPage",
"district.DistrictCenterPage",
"district.DistrictContactPage",
"district.DistrictCrossroadPage",
"district.DistrictCustomPage",
# "district.DistrictElectionPage",
# "district.DistrictElectionPointPage",
"district.DistrictPeoplePage",
"district.DistrictPersonPage",
# "district.DistrictProgramPage",
# "district.DistrictTagsPage",
],
required=False,
),
),
(
"link",
wagtail.blocks.URLBlock(
label="Odkaz", required=False
),
),
]
),
label="Karty odkazu",
),
),
]
),
)
],
blank=True,
verbose_name="Karty rozcestníku",
),
),
]
# Generated by Django 4.0.3 on 2022-04-14 14:06
import wagtail.blocks
import wagtail.contrib.table_block.blocks
import wagtail.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("district", "0053_alter_districtcrossroadpage_cards_content"),
]
operations = [
migrations.AlterField(
model_name="districtcenterpage",
name="content",
field=wagtail.fields.StreamField(
[
("text", wagtail.blocks.RichTextBlock()),
(
"table",
wagtail.contrib.table_block.blocks.TableBlock(
table_options={"renderer": "html"}
),
),
],
blank=True,
verbose_name="Obsah",
),
),
migrations.AlterField(
model_name="districtcustompage",
name="content",
field=wagtail.fields.StreamField(
[
("text", wagtail.blocks.RichTextBlock()),
(
"table",
wagtail.contrib.table_block.blocks.TableBlock(
table_options={"renderer": "html"}
),
),
(
"people_group",
wagtail.blocks.StructBlock(
[
(
"group_title",
wagtail.blocks.CharBlock(
label="Titulek", required=True
),
),
(
"person_list",
wagtail.blocks.ListBlock(
wagtail.blocks.PageChooserBlock(
label="Osoba",
page_type=[
"district.DistrictPersonPage",
],
),
label="List osob",
),
),
]
),
),
],
blank=True,
verbose_name="Obsah",
),
),
]
# Generated by Django 4.0.3 on 2022-04-21 08:57
import wagtail.blocks
import wagtail.contrib.table_block.blocks
import wagtail.fields
import wagtail.images.blocks
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("district", "0054_alter_districtcenterpage_content_and_more"),
]
operations = [
migrations.AlterField(
model_name="districtarticlepage",
name="content",
field=wagtail.fields.StreamField(
[
(
"text",
wagtail.blocks.RichTextBlock(
features=[
"h2",
"h3",
"h4",
"bold",
"italic",
"ol",
"embed",
"ul",
"link",
"document-link",
"image",
],
label="Textový editor",
),
),
(
"gallery",
wagtail.blocks.StructBlock(
[
(
"gallery_items",
wagtail.blocks.ListBlock(
wagtail.images.blocks.ImageChooserBlock(
label="obrázek", required=True
),
group="ostatní",
icon="image",
label="Galerie",
),
)
],
label="Galerie",
),
),
(
"youtube",
wagtail.blocks.StructBlock(
[
(
"video_url",
wagtail.blocks.URLBlock(
help_text="Odkaz na YouTube video bude automaticky zkonvertován na ID videa a NEBUDE uložen.",
label="Odkaz na video",
required=False,
),
),
(
"video_id",
wagtail.blocks.CharBlock(
help_text="Není třeba vyplňovat, bude automaticky načteno z odkazu.",
label="ID videa (automatické pole)",
required=False,
),
),
],
label="YouTube video",
),
),
],
blank=True,
verbose_name="Článek",
),
),
migrations.AlterField(
model_name="districtcenterpage",
name="content",
field=wagtail.fields.StreamField(
[
("text", wagtail.blocks.RichTextBlock()),
("table", wagtail.contrib.table_block.blocks.TableBlock()),
],
blank=True,
verbose_name="Obsah",
),
),
migrations.AlterField(
model_name="districtcustompage",
name="content",
field=wagtail.fields.StreamField(
[
("text", wagtail.blocks.RichTextBlock()),
("table", wagtail.contrib.table_block.blocks.TableBlock()),
(
"people_group",
wagtail.blocks.StructBlock(
[
(
"group_title",
wagtail.blocks.CharBlock(
label="Titulek", required=True
),
),
(
"person_list",
wagtail.blocks.ListBlock(
wagtail.blocks.PageChooserBlock(
label="Osoba",
page_type=[
"district.DistrictPersonPage",
],
),
label="List osob",
),
),
]
),
),
],
blank=True,
verbose_name="Obsah",
),
),
migrations.AlterField(
model_name="districtprogrampage",
name="content",
field=wagtail.fields.StreamField(
[
(
"static_program_block",
wagtail.blocks.StructBlock(
[
(
"headline",
wagtail.blocks.CharBlock(
label="Titulek bloku", required=True
),
),
(
"perex",
wagtail.blocks.TextBlock(
label="Krátký text pod nadpisem", required=True
),
),
(
"person",
wagtail.blocks.PageChooserBlock(
label="Garant",
page_type=["district.DistrictPersonPage"],
),
),
(
"completion_percentage",
wagtail.blocks.IntegerBlock(
label="Procento dokončení", required=True
),
),
(
"program_items",
wagtail.blocks.ListBlock(
wagtail.blocks.StructBlock(
[
(
"title",
wagtail.blocks.CharBlock(
label="Název", required=True
),
),
(
"completion_percentage",
wagtail.blocks.IntegerBlock(
label="Procento dokončení",
required=True,
),
),
]
),
label="Seznam bodů",
),
),
]
),
),
(
"redmine_program_block",
wagtail.blocks.StructBlock(
[
(
"headline",
wagtail.blocks.CharBlock(
label="Titulek bloku", required=True
),
),
(
"perex",
wagtail.blocks.TextBlock(
label="Krátký text pod nadpisem", required=True
),
),
(
"person",
wagtail.blocks.PageChooserBlock(
label="Garant",
page_type=["district.DistrictPersonPage"],
),
),
(
"redmine_issue",
wagtail.blocks.IntegerBlock(
label="Číslo Redmine issue", required=True
),
),
(
"completion_percentage",
wagtail.blocks.IntegerBlock(
help_text="Hodnota se automaticky načte s Redmine",
label="Procento dokončení - bude doplněno automaticky",
required=False,
),
),
(
"program_items",
wagtail.blocks.ListBlock(
wagtail.blocks.StructBlock(
[
(
"title",
wagtail.blocks.CharBlock(
label="Název", required=True
),
),
(
"completion_percentage",
wagtail.blocks.IntegerBlock(
label="Procento dokončení",
required=True,
),
),
]
),
help_text="Hodnota se automaticky načte s Redmine",
label="Seznam bodů - bude doplněno automaticky",
required=False,
),
),
]
),
),
],
blank=True,
verbose_name="obsah stránky",
),
),
]
# Generated by Django 4.0.3 on 2022-04-21 08:03
import wagtail.blocks
import wagtail.contrib.table_block.blocks
import wagtail.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("district", "0054_alter_districtcenterpage_content_and_more"),
]
operations = [
migrations.AlterField(
model_name="districtcenterpage",
name="content",
field=wagtail.fields.StreamField(
[
("text", wagtail.blocks.RichTextBlock()),
("table", wagtail.contrib.table_block.blocks.TableBlock()),
],
blank=True,
verbose_name="Obsah",
),
),
migrations.AlterField(
model_name="districtcustompage",
name="content",
field=wagtail.fields.StreamField(
[
("text", wagtail.blocks.RichTextBlock()),
("table", wagtail.contrib.table_block.blocks.TableBlock()),
(
"people_group",
wagtail.blocks.StructBlock(
[
(
"group_title",
wagtail.blocks.CharBlock(
label="Titulek", required=True
),
),
(
"person_list",
wagtail.blocks.ListBlock(
wagtail.blocks.PageChooserBlock(
label="Osoba",
page_type=[
"district.DistrictPersonPage",
],
),
label="List osob",
),
),
]
),
),
],
blank=True,
verbose_name="Obsah",
),
),
migrations.AlterField(
model_name="districtprogrampage",
name="content",
field=wagtail.fields.StreamField(
[
(
"static_program_block",
wagtail.blocks.StructBlock(
[
(
"headline",
wagtail.blocks.CharBlock(
label="Titulek bloku", required=True
),
),
(
"perex",
wagtail.blocks.TextBlock(
label="Krátký text pod nadpisem", required=True
),
),
(
"person",
wagtail.blocks.PageChooserBlock(
label="Garant",
page_type=["district.DistrictPersonPage"],
),
),
(
"completion_percentage",
wagtail.blocks.IntegerBlock(
label="Procento dokončení", required=True
),
),
(
"program_items",
wagtail.blocks.ListBlock(
wagtail.blocks.StructBlock(
[
(
"title",
wagtail.blocks.CharBlock(
label="Název", required=True
),
),
(
"completion_percentage",
wagtail.blocks.IntegerBlock(
label="Procento dokončení",
required=True,
),
),
]
),
label="Seznam bodů",
),
),
]
),
),
(
"redmine_program_block",
wagtail.blocks.StructBlock(
[
(
"headline",
wagtail.blocks.CharBlock(
label="Titulek bloku", required=True
),
),
(
"perex",
wagtail.blocks.TextBlock(
label="Krátký text pod nadpisem", required=True
),
),
(
"person",
wagtail.blocks.PageChooserBlock(
label="Garant",
page_type=["district.DistrictPersonPage"],
),
),
(
"redmine_issue",
wagtail.blocks.IntegerBlock(
label="Číslo Redmine issue", required=True
),
),
(
"completion_percentage",
wagtail.blocks.IntegerBlock(
help_text="Hodnota se automaticky načte s Redmine",
label="Procento dokončení - bude doplněno automaticky",
required=False,
),
),
(
"program_items",
wagtail.blocks.ListBlock(
wagtail.blocks.StructBlock(
[
(
"title",
wagtail.blocks.CharBlock(
label="Název", required=True
),
),
(
"completion_percentage",
wagtail.blocks.IntegerBlock(
label="Procento dokončení",
required=True,
),
),
]
),
help_text="Hodnota se automaticky načte s Redmine",
label="Seznam bodů - bude doplněno automaticky",
required=False,
),
),
]
),
),
],
blank=True,
verbose_name="obsah stránky",
),
),
]
# Generated by Django 4.0.3 on 2022-04-25 08:24
import wagtail.blocks
import wagtail.fields
import wagtail.images.blocks
from django.db import migrations
from wagtail.blocks.stream_block import StreamValue
def plain_to_structured(block):
modified_items = []
for item in block["value"]["contact_list"]:
modified_items.append(
{
**item,
"value": {
"person": item["value"],
"position": "",
},
}
)
block["value"]["contact_list"] = modified_items
return block
def structured_to_plain(block):
modified_items = []
for item in block["value"]["contact_list"]:
modified_items.append({**item, "value": item["value"]["person"]})
block["value"]["contact_list"] = modified_items
return block
def get_sidebar_content(page, mapper):
stream_data = []
mapped = False
for block in page.sidebar_content.raw_data:
if block["type"] == "contact":
stream_data.append(mapper(block))
mapped = True
else:
stream_data.append(block)
return stream_data, mapped
def migrate(apps, mapper):
DistrictCenterPage = apps.get_model("district", "DistrictCenterPage")
for page in DistrictCenterPage.objects.all():
sidebar_content, mapped = get_sidebar_content(page, mapper)
if mapped:
page.sidebar_content = StreamValue(
page.sidebar_content, sidebar_content, is_lazy=True
)
page.save()
def forwards(apps, schema_editor):
migrate(apps, plain_to_structured)
def backwards(apps, schema_editor):
migrate(apps, structured_to_plain)
class Migration(migrations.Migration):
dependencies = [
("district", "0055_alter_districtcenterpage_content_and_more"),
]
operations = [
migrations.AlterField(
model_name="districtcenterpage",
name="sidebar_content",
field=wagtail.fields.StreamField(
[
(
"address",
wagtail.blocks.StructBlock(
[
(
"title",
wagtail.blocks.CharBlock(
label="Titulek", required=True
),
),
(
"map_image",
wagtail.images.blocks.ImageChooserBlock(
label="Obrázek mapy", required=False
),
),
(
"map_link",
wagtail.blocks.URLBlock(
label="Odkaz na detail mapy", required=False
),
),
(
"address",
wagtail.blocks.TextBlock(
label="Adresa", required=True
),
),
(
"address_info",
wagtail.blocks.TextBlock(
label="Info k adrese", required=False
),
),
]
),
),
(
"contact",
wagtail.blocks.StructBlock(
[
(
"title",
wagtail.blocks.CharBlock(
label="Titulek", required=True
),
),
(
"contact_list",
wagtail.blocks.ListBlock(
wagtail.blocks.StructBlock(
[
(
"person",
wagtail.blocks.PageChooserBlock(
label="Osoba",
page_type=[
"district.DistrictPersonPage"
],
),
),
(
"position",
wagtail.blocks.CharBlock(
label="Pozice", required=False
),
),
]
)
),
),
]
),
),
],
blank=True,
verbose_name="Obsah bočního panelu",
),
),
migrations.AlterField(
model_name="districtcenterpage",
name="text",
field=wagtail.fields.RichTextField(
blank=True, null=True, verbose_name="Text"
),
),
migrations.RunPython(forwards, backwards),
]