kopia lustrzana https://github.com/wagtail/wagtail
pull/5997/head
rodzic
72ee81fbe5
commit
9987c46647
|
@ -16,6 +16,7 @@ Changelog
|
|||
* Fix: Ensure link to add a new user works when no users are visible in the users list (LB (Ben Johnston))
|
||||
* Fix: `AbstractEmailForm` saved submission fields are now aligned with the email content fields, `form.cleaned_data` will be used instead of `form.fields` (Haydn Greatnews)
|
||||
* Fix: Removed ARIA `role="table"` from TableBlock output (Thibaud Colas)
|
||||
* Fix: Set Cache-Control header to prevent page preview responses from being cached (Tomas Walch)
|
||||
|
||||
|
||||
2.9 (xx.xx.xxxx) - IN DEVELOPMENT
|
||||
|
|
|
@ -30,6 +30,7 @@ Bug fixes
|
|||
* Ensure link to add a new user works when no users are visible in the users list (LB (Ben Johnston))
|
||||
* ``AbstractEmailForm`` saved submission fields are now aligned with the email content fields, ``form.cleaned_data`` will be used instead of ``form.fields`` (Haydn Greatnews)
|
||||
* Removed ARIA `role="table"` from TableBlock output (Thibaud Colas)
|
||||
* Set Cache-Control header to prevent page preview responses from being cached (Tomas Walch)
|
||||
|
||||
|
||||
Upgrade considerations
|
||||
|
|
|
@ -8,7 +8,7 @@ from django.contrib.auth.models import Permission
|
|||
from django.core import mail
|
||||
from django.core.files.base import ContentFile
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
from django.test import TestCase, modify_settings
|
||||
from django.test import TestCase, modify_settings, override_settings
|
||||
from django.urls import reverse
|
||||
from django.utils import timezone
|
||||
|
||||
|
@ -694,6 +694,35 @@ class TestPageEdit(TestCase, WagtailTestUtils):
|
|||
html=True
|
||||
)
|
||||
|
||||
@override_settings(CACHES={
|
||||
'default': {
|
||||
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
|
||||
}})
|
||||
@modify_settings(MIDDLEWARE={
|
||||
'append': 'django.middleware.cache.FetchFromCacheMiddleware',
|
||||
'prepend': 'django.middleware.cache.UpdateCacheMiddleware',
|
||||
})
|
||||
def test_preview_does_not_cache(self):
|
||||
'''
|
||||
Tests solution to issue #5975
|
||||
'''
|
||||
post_data = {
|
||||
'title': "I've been edited one time!",
|
||||
'content': "Some content",
|
||||
'slug': 'hello-world',
|
||||
'action-submit': "Submit",
|
||||
}
|
||||
preview_url = reverse('wagtailadmin_pages:preview_on_edit',
|
||||
args=(self.child_page.id,))
|
||||
self.client.post(preview_url, post_data)
|
||||
response = self.client.get(preview_url)
|
||||
self.assertContains(response, "I've been edited one time!", html=True)
|
||||
|
||||
post_data['title'] = "I've been edited two times!"
|
||||
self.client.post(preview_url, post_data)
|
||||
response = self.client.get(preview_url)
|
||||
self.assertContains(response, "I've been edited two times!", html=True)
|
||||
|
||||
@modify_settings(ALLOWED_HOSTS={'append': 'childpage.example.com'})
|
||||
def test_preview_uses_correct_site(self):
|
||||
# create a Site record for the child page
|
||||
|
|
|
@ -19,6 +19,7 @@ from django.http import Http404
|
|||
from django.template.response import TemplateResponse
|
||||
from django.urls import NoReverseMatch, reverse
|
||||
from django.utils import timezone
|
||||
from django.utils.cache import patch_cache_control
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.text import capfirst, slugify
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
@ -1488,7 +1489,9 @@ class Page(AbstractPage, index.Indexed, ClusterableModel, metaclass=PageBase):
|
|||
"""
|
||||
request.is_preview = True
|
||||
|
||||
return self.serve(request)
|
||||
response = self.serve(request)
|
||||
patch_cache_control(response, private=True)
|
||||
return response
|
||||
|
||||
def get_cached_paths(self):
|
||||
"""
|
||||
|
|
Ładowanie…
Reference in New Issue