Handle can_publish seperately from the wagtail CopyForm - #4985
Merged
Merged
Conversation
Contributor
Author
|
@frjo print statements removed 🤦 |
frjo
reviewed
Sep 15, 2026
| can_publish = parent_page.permissions_for_user(request.user).can_publish_subpage() | ||
| if not can_publish: | ||
| raise PermissionDenied(_("You do not have permission to publish this round.")) | ||
|
|
Member
There was a problem hiding this comment.
Is this part needed at all? I tried removing it with no apparent ill effect.
# Parent page defaults to parent of source page
parent_page = page.get_parent()
# Check if the user has permission to publish subpages on the parent
can_publish = parent_page.permissions_for_user(request.user).can_publish_subpage()
if not can_publish:
raise PermissionDenied(_("You do not have permission to publish this round."))
Contributor
Author
There was a problem hiding this comment.
I'm not sure - I also didn't see anything nasty happen when I removed them as well but wasn't sure if there was an edge case or reason that logic was there in the first place? happy to remove it though
Member
There was a problem hiding this comment.
I suspect it is code to handle old Wagtail behaviour.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Quick fix for copying rounds directly in wagtail - currently it will error out if copied due to wagtail not accepting
can_publishas an argumentTest Steps