infoportugal / wagtail-modeltranslation

Simple app to patch modeltranslation (https://github.com/deschler/django-modeltranslation) into Wagtail CMS.
151 stars 119 forks source link

No copy content from buttons in StreamFields #396

Closed Naumov1889 closed 7 months ago

Naumov1889 commented 1 year ago

What I did

After updating from

Django==3.0
wagtail==2.10
wagtail-modeltranslation==0.10.16

to

django==4.1.3
wagtail==4.2.2
wagtail-modeltranslation==0.14.0

I don't see "copy content from" buttons alongside StreamField title.


How it looks

How it was image

How it's now image


The code

models.py

from wagtail.models import Page
from wagtail.fields import StreamField
from wagtail.admin.panels import FieldPanel
from wagtail import blocks

class SectionBlock(blocks.StructBlock):
    text = blocks.CharBlock(required=False)

class BasePage(Page):
    body = StreamField(
        [("section", SectionBlock())],
        null=True,
        blank=True,
        use_json_field=True,
    )
    content_panels = Page.content_panels + [FieldPanel("body")]

translation.py

from modeltranslation.translator import TranslationOptions
from modeltranslation.decorators import register
from .models import BasePage

@register(BasePage)
class BasePageTR(TranslationOptions):
    fields = ("body",)

settings.py

INSTALLED_APPS = [
    'wagtail_modeltranslation',
    'wagtail_modeltranslation.makemigrations',
    'wagtail_modeltranslation.migrate',
    'myapp',
]

MODELTRANSLATION_DEFAULT_LANGUAGE = 'ru'
MODELTRANSLATION_PREPOPULATE_LANGUAGE = 'en'
WAGTAILMODELTRANSLATION_TRANSLATE_SLUGS = False

LANGUAGE_CODE = 'ru'
LANGUAGES = [
    ('ru', 'Russian'),
    ('en', 'English'),
]
TheCodingSheikh commented 1 year ago

fixed with this pull request https://github.com/infoportugal/wagtail-modeltranslation/pull/410