Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No copy content from buttons in StreamFields #396

Closed
Naumov1889 opened this issue Jul 30, 2023 · 1 comment
Closed

No copy content from buttons in StreamFields #396

Naumov1889 opened this issue Jul 30, 2023 · 1 comment

Comments

@Naumov1889
Copy link

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
Copy link
Contributor

fixed with this pull request
#410

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants