#15564 closed (wontfix)
PROPOSAL: nocache template tag to exclude parts of a template from being cached
Reported by: | 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 , 14 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
comment:2 by , 14 years ago
Resolution: | wontfix |
---|---|
Status: | closed → reopened |
A good example can be found at:
http://www.holovaty.com/writing/django-two-phased-rendering/
comment:3 by , 14 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 , 14 years ago
Resolution: | → wontfix |
---|---|
Status: | reopened → closed |
Closing as wontfix again since this clearly needs discussion on django-developers.
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.