You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you are trying to exclude related fields from being copied, the revision content ends up with a value of DeferringRelatedManager and throws an error on revision.save():
Object of type DeferringRelatedManager is not JSON serializable
Steps to Reproduce
Set up a model, say, blog and a related model author, so you have blog.authors.all()
Set BlogPage.exclude_fields_in_copy = ["authors"].
Try and copy a blog instance from Wagtail admin
💥
I have confirmed that this issue can be reproduced as described on a fresh Wagtail project: yes
Technical details
Python version: 3.11
Django version: 5.0.2
Wagtail version: 6.0.1
Working on this
I think the approach would be to properly exclude the field from the revision. Not sure why it's getting the value from page_copy -
Issue Summary
If you are trying to exclude related fields from being copied, the revision content ends up with a value of
DeferringRelatedManager
and throws an error onrevision.save():
Steps to Reproduce
blog
and a related modelauthor
, so you haveblog.authors.all()
BlogPage.exclude_fields_in_copy = ["authors"]
.Technical details
Working on this
I think the approach would be to properly exclude the field from the revision. Not sure why it's getting the value from
page_copy
-https://github.com/wagtail/wagtail/blob/main/wagtail/actions/copy_page.py#L224-L230
This code here causes it to be set to a related manager value.
The text was updated successfully, but these errors were encountered: