#11416 closed (fixed)
Django Admin no longer uses never_cache, breaks with site-wide cache
| Reported by: | Michael Newman | Owned by: | nobody |
|---|---|---|---|
| Component: | contrib.admin | Version: | dev |
| Severity: | Keywords: | admin cache | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
When site cache is enabled using middleware
'django.middleware.cache.UpdateCacheMiddleware',
'django.middleware.cache.FetchFromCacheMiddleware',
The admin site is broken because the never_cache decorators have been removed from the views.
Attachments (3)
Change History (10)
comment:1 by , 16 years ago
| Resolution: | → invalid |
|---|---|
| Status: | new → closed |
comment:2 by , 16 years ago
The model_page function you are referring to is no longer used by the new get_urls function. Am I missing something else?
comment:3 by , 16 years ago
| Resolution: | invalid |
|---|---|
| Status: | closed → reopened |
I hate to reopen my own ticket, but I am sure that the new urls don't properly receive the cache headers.
by , 16 years ago
| Attachment: | 11416-admin-caching.diff added |
|---|
Patch with a test to ensure there is a max-age on the response from the admin
by , 16 years ago
| Attachment: | 11416-never-cache-admin-views.diff added |
|---|
S slightly modified approach for the patch
comment:4 by , 16 years ago
The attached patch implements something Alex Gaynor suggested on IRC: Moving the addition of never_cache decorator application to the admin_view AdminSite method.
The patchs also:
- Adds a test for a non-model-specific view like an app index view so both
AdminSiteandModelAdminbehaviour is tested. - Adds documentation.
by , 16 years ago
| Attachment: | 11416-admin-caching.2.diff added |
|---|
Slightly modified version of the patch Ramiro uploaded, without some unrelated import and spacing changes and because admin_site.admin_view is used in the wrapper in the ModelAdmin views, there is no need for a decorator change in the ModelAdmin
comment:5 by , 16 years ago
| Has patch: | set |
|---|---|
| milestone: | → 1.1 |
I am going to mark this to 1.1 milestone since it will break some deployments and is unexpected behavior. Also this is functionality that has been downgraded in the admin since 1.0. If someone feels otherwise, please feel free to change.
comment:6 by , 16 years ago
| Resolution: | → fixed |
|---|---|
| Status: | reopened → closed |
AdminSiteapplies thenever_cachedecorator as part of its internal dispatch to theModelAdminclass; see around line 500 ofcontrib/admin.sites.py.