Skip to content

Monkey-patch modelcluster bug and take fix for related actions back into use#420

Merged
juyrjola merged 2 commits intomainfrom
fix/m2m-prefetch-related-with-lookup
Oct 30, 2025
Merged

Monkey-patch modelcluster bug and take fix for related actions back into use#420
juyrjola merged 2 commits intomainfrom
fix/m2m-prefetch-related-with-lookup

Conversation

@bbliem
Copy link
Copy Markdown
Contributor

@bbliem bbliem commented Oct 29, 2025

Description

We recently changed related_actions of the Action model to a ParentalManyToManyField in order to fix the bug that related actions were not saved. While this fixed the bug, it made the action list in the frontend behave in an odd way. (The actions were no longer grouped by categories.) Closer investigation showed that this is due to a bug in django-modelcluster. I made a PR: wagtail/django-modelcluster#203

Until that PR to modelcluster is merged and taken into use, we can use the monkey-patch proposed by the current PR.

Related issue

https://app.asana.com/1/1201243246741462/project/1206017643443542/task/1211588710979857?focus=true

Testing

A unit test has been included in my PR to modelcluster.

This should be removed once this pull request is merged to modelcluster:
wagtail/django-modelcluster#203
Copy link
Copy Markdown
Contributor

@tituomin tituomin left a comment

Choose a reason for hiding this comment

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

Beautiful!

@tituomin
Copy link
Copy Markdown
Contributor

It occured to me though that especially with monkey patches, maybe a regression test would be nice.

@juyrjola juyrjola merged commit 26333f4 into main Oct 30, 2025
11 checks passed
@juyrjola juyrjola deleted the fix/m2m-prefetch-related-with-lookup branch October 30, 2025 09:42
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.

3 participants