Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#15564 closed (wontfix)

PROPOSAL: nocache template tag to exclude parts of a template from being cached

Reported by: izamojc@… Owned by: nobody
Component: Core (Cache system) Version: dev
Severity: Keywords: template tag
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

In many cases, I'd like to just be able to turn caching on for a project and let it do what it does automatically 99% of the time. However, most sites have authentication, and most display a "login or signup" message that gets replaced by the user's name when they sign in. This is problematic for caching since it means that same page will be cached multiple times, once for each user who views it, defeating the purpose of the cache.

I propose a formal {% nocache %} ... {% endnocache %} template tag that can be wrapped around these "micro-dynamic" regions of the template. This way, blanket caching can be applied to the entire site, and these cache-busting problem areas can be dealt with in a precise manner.

Change History (5)

comment:1 by Russell Keith-Magee, 13 years ago

Resolution: wontfix
Status: newclosed

Yes, this would be nice to have... but then, so would a magical pony :-)

The use case you describe would clearly be useful, but I'm not sure I see how this could be implemented. Essentially you're asking for partially parsed template contents, where the template can be compiled, *except* for one tag that will be compiled at a later date. Implementing this sort of dual-compilation template *might* be possible, but it's not as simple as "just add a a nocache tag".

Closing wontfix for that reason. If you can provide a clear explanation of how this would actually be implemented (preferably with example code demonstrating the plausibility of your approach) feel free to reopen.

comment:2 by izamojc@…, 13 years ago

Resolution: wontfix
Status: closedreopened

comment:3 by Jannis Leidel, 13 years ago

For the record, Cody and me worked on a reusable app that implements the two-phase-rendering: http://pypi.python.org/pypi/django-phased (Code at https://github.com/codysoyland/django-phased)

comment:4 by Jannis Leidel, 13 years ago

Resolution: wontfix
Status: reopenedclosed

Closing as wontfix again since this clearly needs discussion on django-developers.

comment:5 by Jacob, 13 years ago

milestone: 1.4

Milestone 1.4 deleted

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