Code

Opened 3 years ago

Closed 3 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

Description

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@… 3 years ago.
class based cache settings patch

Download all attachments as: .zip

Change History (2)

Changed 3 years ago by rob@…

class based cache settings patch

comment:1 Changed 3 years ago by ptone

  • Cc preston@… added
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to duplicate
  • Status changed from new to closed

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.