-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Fix for issue #1555 and #1620: Page path rewriting when published page becomes the HOME page #1647
Conversation
…g when published page becomes the HOME page * when CMS_MODERATOR = True: if the draft page is unpublished, the public version is also unpublished * when determining the home page, ignore publication_date and publication_end_date this ensures that the home page path rewriting logic happens even if the page will only become available somewhere in the future * change the post_save_page signal handler so that it also updates the: ** paths(titles) of the currently saved page ** if the currently saved page becomes the new home page, then update the paths(titles) of the previous home page ** if the currently saved page used to be the home page, then update the paths(titles) of the new home page * add pre/post delete signal handlers that: if the currently deleted page was the home page then update the path of the new home page * Added unit tests for all the above functionality This ensures that: * we will always have AT MOST one page with the '' (empty) path * no matter what publishing method is used (tick the publish/unpublish checkbox in the page hierarchy, tick the 'is published' checkbox from the 'change page' view OR click 'publish' while doing frontend editing) the generated paths are consistent
I will also try to provide a fix for these two bugs on the develop branch. However, since the publishing functionality changed quite a lot, the fix might need to be slightly different. |
else: | ||
if home_page.pk == instance.pk: | ||
for title in Title.objects.filter(path=''): | ||
if title not in instance.title_set.all(): |
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.
i'm not 100% sure, but doesn't this execute the query n
times (n
being the amount of titles with path='')?
Same goes for below. I think you should explicitly execute the instance.title_set.all()
query by casting it to a list just after the if statement above.
…nstance's site (otherise titles of home pages from all other sites are returned)
Changes Unknown when pulling 22faaa1 on pbs:issue_1555 into * on divio:support/2.3.x*. |
Fix for #1555 and #1620 on the 2.3.x branch
if the draft page is unpublished, the public version is also unpublished
this ensures that the home page path rewriting logic happens even if the page will only become available
somewhere in the future
** paths(titles) of the currently saved page
** if the currently saved page becomes the new home page, then update the paths(titles) of the previous home page
** if the currently saved page used to be the home page, then update the paths(titles) of the new home page
then update the path of the new home page
This ensures that: