Added global wagtailadmin cache settings

pull/913/head
Karl Hobley 2015-01-19 13:46:19 +00:00
rodzic a437c1471f
commit 617aced004
2 zmienionych plików z 14 dodań i 0 usunięć

Wyświetl plik

@ -28,6 +28,14 @@ class TestHome(TestCase, WagtailTestUtils):
response = self.client.get(reverse('wagtailadmin_home') + '?hide-kittens=true')
self.assertNotContains(response, '<a href="http://www.tomroyal.com/teaandkittens/" class="icon icon-kitten" data-fluffy="yes">Kittens!</a>')
def test_never_cache_header(self):
# This tests that wagtailadmins global cache settings have been applied correctly
response = self.client.get(reverse('wagtailadmin_home'))
self.assertIn('private', response['Cache-Control'])
self.assertIn('no-cache', response['Cache-Control'])
self.assertIn('no-store', response['Cache-Control'])
class TestEditorHooks(TestCase, WagtailTestUtils):
def setUp(self):

Wyświetl plik

@ -1,5 +1,6 @@
from django.conf.urls import url
from django.contrib.auth.decorators import permission_required
from django.views.decorators.cache import cache_control
from wagtail.wagtailadmin.forms import PasswordResetForm
from wagtail.wagtailadmin.views import account, chooser, home, pages, tags, userbar, page_privacy
@ -117,3 +118,8 @@ urlpatterns += [
}, name='wagtailadmin_password_reset_complete'
),
]
# Decorate all views with cache settings to prevent caching
urlpatterns = decorate_urlpatterns(urlpatterns,
cache_control(private=True, no_cache=True, no_store=True)
)