-
Notifications
You must be signed in to change notification settings - Fork 126
Open
Description
When i make a new page, i need to build the content with all the blocks. Text, images, and all that. When i want to do the same for the Dutch version, i need to repeat all those steps to rebuild the page from scratch. This is a waste of time. i would like a function that allows us to copy the blocks from one language, and paste them into the section of the other language, so i only need to change the text, and not add all the images and stuff again.
but if there are best other solution am glad to hear!!!
the targeted flexindexpage ==>
the models.py:
from django.db import models
from modelcluster.fields import ParentalKey
from wagtail.admin.panels import FieldPanel, InlinePanel, MultiFieldPanel
from wagtail.fields import StreamField
from wagtail.models import Orderable, Page
from wagtailmenus.models import MenuPage
from except_wagtail.abstract_models import AbstractHero
from except_wagtail.blocks import BaseStreamBlock
class FlexIndexHeroImage(Orderable):
"""
Image for carousel in hero section.
"""
image = models.ForeignKey(
"wagtailimages.Image",
on_delete=models.SET_NULL,
blank=True,
null=True,
related_name="+",
)
page = ParentalKey("FlexIndexPage", related_name="hero_images")
panels = [
FieldPanel("image"),
]
class FlexIndexPage(AbstractHero, MenuPage):
intro_free_content = StreamField(
BaseStreamBlock(),
null=True,
blank=True,
use_json_field=True,
verbose_name="Working area free content",
help_text="Working Page Free Content Area",
)
content_panels = Page.content_panels + [
MultiFieldPanel(
[
FieldPanel("hero_title"),
FieldPanel("hero_subtitle"),
FieldPanel("hero_video"),
FieldPanel("hero_video_poster"),
FieldPanel("hero_image"),
FieldPanel("hero_halved"),
FieldPanel("hero_slider_parallax"),
InlinePanel(
"hero_images",
classname="full",
label="Hero section carousel images",
),
],
heading="Hero section",
classname="collapsible",
),
FieldPanel("intro_free_content"),
]
# parent_page_types = ["index.HomePage", "flex.FlexIndexPage"]
def get_context(self, request):
context = super().get_context(request)
context["parallax"] = self.hero_slider_parallax
return context
translations.py:
from modeltranslation.decorators import register
from modeltranslation.translator import TranslationOptions
from .models import FlexIndexPage
@register(FlexIndexPage)
class FlexIndexPageTR(TranslationOptions):
fields = (
"hero_title",
"hero_subtitle",
"intro_free_content",
)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels