Ticket #11416: 11416-admin-caching.diff
File 11416-admin-caching.diff, 2.3 KB (added by , 15 years ago) |
---|
-
django/contrib/admin/options.py
20 20 from django.utils.translation import ugettext as _ 21 21 from django.utils.translation import ungettext, ugettext_lazy 22 22 from django.utils.encoding import force_unicode 23 from django.views.decorators.cache import never_cache 23 24 try: 24 25 set 25 26 except NameError: … … 224 225 def wrap(view): 225 226 def wrapper(*args, **kwargs): 226 227 return self.admin_site.admin_view(view)(*args, **kwargs) 227 return update_wrapper(wrapper, view)228 return never_cache(update_wrapper(wrapper, view)) 228 229 229 230 info = self.admin_site.name, self.model._meta.app_label, self.model._meta.module_name 230 231 -
django/contrib/admin/sites.py
190 190 def wrap(view): 191 191 def wrapper(*args, **kwargs): 192 192 return self.admin_view(view)(*args, **kwargs) 193 return update_wrapper(wrapper, view)193 return never_cache(update_wrapper(wrapper, view)) 194 194 195 195 # Admin-site-wide views. 196 196 urlpatterns = patterns('', -
tests/regressiontests/admin_views/tests.py
52 52 """ 53 53 response = self.client.get('/test_admin/%s/admin_views/section/add/' % self.urlbit) 54 54 self.failUnlessEqual(response.status_code, 200) 55 56 def testMaxAge(self): 57 """ 58 Because cache time can be set by middleware, ensure max-age is explicity 0 59 """ 60 response = self.client.get('/test_admin/%s/admin_views/section/add/' % self.urlbit) 61 62 from django.utils.cache import get_max_age 63 self.failUnlessEqual(get_max_age(response), 0) 55 64 56 65 def testAddWithGETArgs(self): 57 66 response = self.client.get('/test_admin/%s/admin_views/section/add/' % self.urlbit, {'name': 'My Section'})