Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 3 additions & 0 deletions CHANGELOG.markdown
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## Next release
* Fix recovering Page objects with reversion.

## 4.3.0 - 2019-11-12
* Importing `cms.sitemaps` at the top level of a module containing an app's AppConfig no longer raises `AppRegistryNotReady`.
* `PageBase`'s help text for the `slug` field now makes sense.
Expand Down
10 changes: 9 additions & 1 deletion cms/apps/pages/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from django.template.response import TemplateResponse
from django.urls import reverse
from django.utils import six
from watson.search import update_index
from watson.search import search_context_manager, update_index

from cms.admin import PageBaseAdmin
from cms.apps.pages.models import (Country, CountryGroup, Page,
Expand Down Expand Up @@ -432,6 +432,14 @@ def change_view(self, request, object_id, form_url='', extra_context=None):
# Call the change view.
return super().change_view(request, object_id, form_url=form_url, extra_context=extra_context)

def recover_view(self, request, version_id, extra_context=None):
'''
Stop Watson from trying to index the page during recovery (a situation
where PageInstance.content does not exist).
'''
search_context_manager.invalidate()
return super().recover_view(request, version_id, extra_context=extra_context)

def revision_view(self, request, object_id, version_id, extra_context=None):
'''Load up the correct content inlines.'''
# HACK: Add the current page to the request to pass to the get_inline_instances() method.
Expand Down