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

Fix pages in workflow status showing up as "live + draft" #11013

Closed
wants to merge 2 commits into from

Conversation

laymonage
Copy link
Member

@laymonage laymonage commented Oct 6, 2023

Fixes #10925

It turns out the fix is literally one liner, changing the GenericRelation to use content_type instead of base_content_type. However, that depends on whether we're working with a specific queryset or the base Page queryset. I opted to have two GenericRelations instead so that we can use prefetch_workflow_states() with either, and it will pick the correct relation accordingly.

And yeah, it turns out prefetching GenericRelations with a custom queryset still works fine on Django < 5.0. The one that needs Django >= 5.0 is prefetching GenericForeignKeys, because the result can be of different models.

Please check the following:

  • Do the tests still pass?1
  • Does the code comply with the style guide?
    • Run make lint from the Wagtail root.
  • For Python changes: Have you added tests to cover the new/fixed behaviour?

Please describe additional details for testing this change.

With bakerydemo, the issue in #10925 shouldn't occur anymore.

Footnotes

  1. Development Testing

@squash-labs
Copy link

squash-labs bot commented Oct 6, 2023

Manage this branch in Squash

Test this branch here: https://laymonagefix-moderation-status-quzo6.squash.io

@laymonage laymonage self-assigned this Oct 9, 2023
@laymonage laymonage marked this pull request as ready for review October 9, 2023 14:31
Copy link
Collaborator

@gasman gasman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

gasman added a commit that referenced this pull request Oct 13, 2023
@gasman
Copy link
Collaborator

gasman commented Oct 13, 2023

Merged in ad6688f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Pages in moderation shows as "Live + Draft" in the page listing view instead of "Live + In Moderation"
2 participants