10000 Release 3.6.0 by bplociennik · Pull Request #6605 · django-cms/django-cms · GitHub
[go: up one dir, main page]

Skip to content

Release 3.6.0 #6605

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

Closed
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fixed #6595 -- missing clear cache for a menu after copied page (#6596)
* Add clear cache for copy page form

* Removed fixes for menu cache from changelog
  • Loading branch information
vthaian authored and FinalAngel committed Jan 23, 2019
commit 9e7c0517df3bf97f5a71a880e6085d5f96148186
2 changes: 0 additions & 2 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
=== 3.6.0 (unreleased) ===

* Fixed a bug where menu link is outdated when page moved.
* Fixed a bug where menu link is outdated when page is created.
* Removed the ``cms moderator`` command.
* Dropped Django < 1.11 support.
* Removed the translatable content get / set methods from ``CMSPlugin`` model.
Expand Down
1 change: 1 addition & 0 deletions cms/admin/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,7 @@ def copy_page(self):
copy_permissions=copy_permissions,
target_site=self._site,
)
new_page.clear_cache(menu=True)
return new_page

def _get_tree_options_for_root(self, position):
Expand Down
34 changes: 34 additions & 0 deletions cms/tests/test_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,40 @@ def test_show_page_in_menu_after_move_page(self):
'Index should not be the same after move page in navigation'
)

def test_show_page_in_menu_after_copy_page(self):
"""
Test checks if the menu cache is cleaned after copy page.
"""
page = create_page('page to copy', 'nav_playground.html', 'en', published=True)

request = self.get_request('/')
renderer = menu_pool.get_renderer(request)
renderer.draft_mode_active = True
nodes_before = renderer.get_nodes()
self.assertEqual(CacheKey.objects.count(), 1)

with self.login_user_context(self.get_superuser()):
# Copy the page
data = {
'position': 1,
'source_site': 1,
'copy_permissions': 'on',
'copy_moderation': 'on',
}
endpoint = self.get_admin_url(Page, 'copy_page', page.pk)
response = self.client.post(endpoint, data)
self.assertEqual(response.status_code, 200)
self.assertEqual(CacheKey.objects.count(), 0)

request = self.get_request('/')
renderer = menu_pool.get_renderer(request)
renderer.draft_mode_active = True
nodes_after = renderer.get_nodes()

self.assertEqual(CacheKey.objects.count(), 1)
self.assertGreater(len(nodes_after), len(nodes_before))
self.assertEqual(page.get_title(), nodes_after[-1].title)

def test_cms_menu_public_with_multiple_languages(self):
for page in Page.objects.drafts():
create_title(
Expand Down
0