wagtail / wagtail-localize

Translation plugin for Wagtail CMS
https://wagtail-localize.org/
Other
222 stars 84 forks source link

wagtail 5.2 compatability #733

Closed aekong closed 10 months ago

aekong commented 10 months ago

The most recent release of wagtail 5.2 replaces PagePreviewSidePanel with PreviewSidePanel.

wagtail_localize/side_panels.py needs a small update to comply

zerolab commented 10 months ago

@aekong thank you for this. The change needs to be conditional (ie only use PreviewSidePanel in 5.2 and leave the rest as-is). I triggered the CI nonetheless to surface any other failures

aekong commented 10 months ago

ah ok, like this?

try:
    # for wagtail 5.2
    from wagtail.admin.ui.side_panels import PageStatusSidePanel, PreviewSidePanel
except ImportError:
    from wagtail.admin.ui.side_panels import PagePreviewSidePanel as PreviewSidePanel, PageSidePanels as PageStatusSidePanel
zerolab commented 10 months ago

@aekong that works. The preferred pattern that Wagtail uses is:

from wagtail import VERSION as WAGTAIL_VERSION

if WAGTAIL_VERSION >= (5, 2):
    from wagtail.admin.ui.side_panels import PageStatusSidePanel, PreviewSidePanel
else:
    from wagtail.admin.ui.side_panels import PagePreviewSidePanel as PreviewSidePanel, PageSidePanels as PageStatusSidePanel

This has the added benefit of being easily searchable when we drop support for Wagtail < 5.2

aekong commented 10 months ago

ah got it, thanks! 1872b2b59ab779ff4646ea700c58c29c2144813d

zerolab commented 10 months ago

@aekong thanks for making a start on this. I will take over as there a more fundamental changes we need to account for

aekong commented 10 months ago

sounds good, thank you! if you have time, what are some of those fundamental changes? no worries if you don't have bandwidth to respond to this - just for my own curiosity. i am pretty new to wagtail in general

zerolab commented 10 months ago

Superseded by #735. Thank you for starting this @aekong

zerolab commented 10 months ago

version 1.7rc1 is now out.

You can use wagtail-localize==1.7rc1 in your requirements file.

aekong commented 10 months ago

awesome, thanks!