Opened 7 years ago

Closed 7 years ago

#16892 closed New feature (duplicate)

Allow class based view 'cache_timeout' to control middleware.

Reported by: rob@… Owned by: nobody
Component: Generic views Version: 1.3
Severity: Normal Keywords: CBV Cache
Cc: preston@… Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Allow cache timeout to be controlled by an attribute ('cache_timeout') on class based views. This allows cache timeout to be controlled on groups of views with inheritance (or mixins) without having to implement settings for each individual view.

It relies on setting the class based view into an attribute of the view function created by View.as_view. This can then be checked for and interrogated in the UpdateCacheMiddleware.

Attachments (1)

class-based-view-caching.diff (1.5 KB) - added by rob@… 7 years ago.
class based cache settings patch

Download all attachments as: .zip

Change History (2)

Changed 7 years ago by rob@…

class based cache settings patch

comment:1 Changed 7 years ago by Preston Holmes

Cc: preston@… added
Resolution: duplicate
Status: newclosed

This is really a specific case of #14512, in particular, the issue of representing decorator parameters as inheritable class attribute

Note: See TracTickets for help on using tickets.
Back to Top