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

wagtail 5.2 compatability #733

Closed
wants to merge 2 commits into from

Conversation

aekong
Copy link

@aekong aekong commented Nov 2, 2023

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

wagtail_localize/side_panels.py needs a small update to comply

@zerolab
Copy link
Collaborator

zerolab commented Nov 2, 2023

@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
Copy link
Author

aekong commented Nov 2, 2023

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

zerolab commented Nov 2, 2023

@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
Copy link
Author

aekong commented Nov 2, 2023

ah got it, thanks! 1872b2b

@zerolab
Copy link
Collaborator

zerolab commented Nov 3, 2023

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

@aekong
Copy link
Author

aekong commented Nov 3, 2023

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 zerolab mentioned this pull request Nov 6, 2023
1 task
@zerolab
Copy link
Collaborator

zerolab commented Nov 6, 2023

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

@zerolab zerolab closed this Nov 6, 2023
@zerolab
Copy link
Collaborator

zerolab commented Nov 7, 2023

version 1.7rc1 is now out.

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

@aekong
Copy link
Author

aekong commented Nov 7, 2023

awesome, thanks!

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

Successfully merging this pull request may close these issues.

2 participants