8000 Remove revert to live feature by Aiky30 · Pull Request #6454 · django-cms/django-cms · GitHub
[go: up one dir, main page]

Skip to content

Remove revert to live feature #6454

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

Merged
Merged
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
Removed revert to live control from the toolbar and supporting method…
…s in the page model
  • Loading branch information
Andrew Aikman committed Jul 18, 2018
commit c032d848fc510f2cc8a3707dca03a3b6e189c214
24 changes: 0 additions & 24 deletions cms/cms_toolbars.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,30 +606,6 @@ def add_page_menu(self):
on_success=refresh,
)

if self.current_lang and not self.page.is_page_type:
# revert to live
current_page_menu.add_break(PAGE_MENU_FOURTH_BREAK)
revert_action = admin_reverse('cms_page_revert_to_live', args=(self.page.pk, self.current_lang))
revert_question = _('Are you sure you want to revert to live?')
# Only show this action if the page has pending changes and a public version
is_enabled = (
edit_mode
and can_change
and self.page.i 8000 s_dirty(self.current_lang)
and self.page.publisher_public
)
current_page_menu.add_ajax_item(
_('Revert to live'),
action=revert_action,
question=revert_question,
disabled=not is_enabled,
on_success=refresh,
extra_classes=('cms-toolbar-revert',),
)

# last break
current_page_menu.add_break(PAGE_MENU_LAST_BREAK)

# delete
if self.page.is_page_type:
delete_url = admin_reverse('cms_pagetype_delete', args=(self.page.pk,))
Expand Down
23 changes: 0 additions & 23 deletions cms/models/pagemodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -1199,29 +1199,6 @@ def mark_descendants_as_published(self, language):
for child in published_children.iterator():
child.mark_descendants_as_published(language)

def revert_to_live(self, language):
"""Revert the draft version to the same state as the public version
"""
if not self.publisher_is_draft:
# Revert can only be called on draft pages
raise PublicIsUnmodifiable('The public instance cannot be reverted. Use draft.')

public = self.get_public_object()

if not public:
raise PublicVersionNeeded('A public version of this page is needed')

public._copy_attributes(self)
public._copy_titles(self, language, public.is_published(language))

self.update_translations(
language,
published=True,
publisher_state=PUBLISHER_STATE_DEFAULT,
)
self._publisher_keep_state = True
self.save()

def get_draft_object(self):
if not self.publisher_is_draft:
return self.publisher_draft
Expand Down
0