Skip to content
Snippets Groups Projects
Commit 8b225c2f authored by Alexa Valentová's avatar Alexa Valentová
Browse files

run hooks

parent 5052d576
No related branches found
No related tags found
2 merge requests!1047Uniweb redesign,!1045Uniweb redesign, minor district redesign fixes
Pipeline #18825 passed
Showing
with 129968 additions and 164 deletions
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Source diff could not be displayed: it is too large. Options to address this: view the blob.
from django.db import migrations
from wagtail.blocks import StreamBlock, StructBlock
def migrate_button_blocks(apps, schema_editor):
model_fields = {
......@@ -11,45 +11,43 @@ def migrate_button_blocks(apps, schema_editor):
def process_block(block):
# Perform your block transformation logic here
# For example, replace some blocks with different blocks
if block.block_type == 'button':
if block.block_type == "button":
new_block_value = {
"title": block.value["text"],
"color": "pirati-yellow",
"hoveractive": False,
"page": block.value["page"],
"link": block.value["url"],
"align": "auto"
"align": "auto",
}
new_block = ("new_button", new_block_value)
return new_block
elif block.block_type == 'title':
elif block.block_type == "title":
new_block_value = {
"headline": block.value,
"tag": "h1",
"style": "head-alt-xl",
"align": "auto"
"align": "auto",
}
new_block = ("headline", new_block_value)
return new_block
elif block.block_type == 'advanced_title':
elif block.block_type == "advanced_title":
new_block_value = {
"headline": block.value["title"],
"tag": "h1",
"style": "head-alt-xl",
"align": "auto" if block.value["align"] != "center" else "center"
"align": "auto" if block.value["align"] != "center" else "center",
}
new_block = ("headline", new_block_value)
return new_block
elif block.block_type == 'gallery':
new_block_value = {
"gallery_items": []
}
elif block.block_type == "gallery":
new_block_value = {"gallery_items": []}
for item in block.value:
new_block_value["gallery_items"].append(item)
......@@ -82,9 +80,8 @@ def migrate_button_blocks(apps, schema_editor):
class Migration(migrations.Migration):
dependencies = [
('uniweb', '0071_alter_uniwebflexiblepage_content_and_more'),
("uniweb", "0071_alter_uniwebflexiblepage_content_and_more"),
]
operations = [
......
Source diff could not be displayed: it is too large. Options to address this: view the blob.
......@@ -20,24 +20,22 @@ from wagtail.contrib.forms.panels import FormSubmissionsPanel
from wagtail.contrib.routable_page.models import RoutablePageMixin, route
from wagtail.contrib.table_block.blocks import TableBlock
from wagtail.fields import RichTextField, StreamField
from wagtail.images.blocks import ImageChooserBlock
from wagtail.models import Page
from wagtail.search import index
from wagtailmetadata.models import MetadataPageMixin
from calendar_utils.models import CalendarMixin
from shared.blocks import AdvancedColumnsTextBlock, AdvancedTextBlock
from shared.blocks import ButtonBlock as SharedButtonBlock
from shared.blocks import (
AdvancedTextBlock,
ChartBlock,
ColumnsTextBlock,
GalleryBlock,
HeadlineBlock,
NewsletterSubscriptionBlock,
PictureHeadlineBlock,
ColumnsTextBlock,
AdvancedColumnsTextBlock,
PictureListBlock,
)
from shared.blocks import ButtonBlock as SharedButtonBlock
from shared.const import RICH_TEXT_DEFAULT_FEATURES
from shared.models import (
ArticleMixin,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment