Copying a page: exclude_fields_in_copy breaks with DeferringRelatedManager error when a field is a related field #11715
Labels
status:Unconfirmed
Issue, usually a bug, that has not yet been validated as a confirmed problem.
type:Bug
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: