-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
fix: Placeholder page getter failed for unpublished pages #8115
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
Conversation
Reviewer's Guide by SourceryThe pull request fixes the issue where the placeholder page getter fails for unpublished pages by changing the logic to use PageContent's admin manager for retrieving page objects, ensuring that placeholders on pages without published content are handled correctly. Sequence diagram for placeholder page getter before and after fixsequenceDiagram
participant P as Placeholder
participant PC as PageContent
participant Page as Page
rect rgb(240, 240, 240)
Note over P,Page: Before Fix
P->>Page: get(pagecontent_set__placeholders=self)
alt Page exists and is published
Page-->>P: Return page
else Page doesn't exist or is unpublished
Page-->>P: Return None
end
end
rect rgb(220, 240, 220)
Note over P,Page: After Fix
P->>PC: admin_manager.filter(placeholders=self)
PC->>P: Return PageContent
P->>PC: Get associated page
alt PageContent exists
PC-->>P: Return page
else PageContent doesn't exist
PC-->>P: Return None
end
end
Class diagram showing the relationship between Placeholder, PageContent, and PageclassDiagram
class Placeholder {
-_page
+page_getter()
}
class PageContent {
+admin_manager
+placeholders
+page
}
class Page {
+pagecontent_set
}
Placeholder "*" --> "1" PageContent : belongs to
PageContent "*" --> "1" Page : belongs to
note for Placeholder "Changed to use PageContent's admin_manager"
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @fsbraun - I've reviewed your changes - here's some feedback:
Overall Comments:
- Please remove the commented out code since it's no longer needed and clutters the file.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
@fsbraun Looks good. Let's get this merged. 🚀 |
…#8115) * Fix: Placeholder page getter fails for unpublished pages * Update cms/models/placeholdermodel.py * Update cms/models/placeholdermodel.py
* fix: Placeholder page getter failed for unpublished pages (#8115) * Fix: Placeholder page getter fails for unpublished pages * Update cms/models/placeholdermodel.py * Update cms/models/placeholdermodel.py * fix: Use correct `changed_date` of page content in sitemap (#8122) * Sitemap returns changed_date for page content object * Avoid prefetch by modifying the subquery * Update tests for sitemap * Update test_plugins.py * Update test_page.py --------- Co-authored-by: Fabian Braun <fsbraun@gmx.de> * Update databases.txt --------- Co-authored-by: Jacob Rief <jacob.rief@gmail.com>
Description
placeholder.page
does not use the admin manager to retrieve a page object. This leads it to beingNone
also for placeholders on pages which have no published content. This might lead to page-related placeholder configuration being ignored.Related resources
Checklist
develop-4
Summary by Sourcery
Bug Fixes: