#29562: Allow the cache template tag to take a function that adds context data
---------------------------------+--------------------------------------
Reporter: HongWeipeng | Owner: nobody
Type: New feature | Status: closed
Component: Template system | Version: master
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Changes (by Tim Graham):
* status: new => closed
* component: Core (Cache system) => Template system
* resolution: => wontfix
Comment:
I think the proposed functionality is clever but it's too magical for my
liking. Allowing the template tag's "fragment name" to be a function whose
return value, if a dictionary, is added to the context looks like it
wouldn't help template readability.
Also, I don't think the enhancement is in line with the philosophy of the
Django template language, "the template system is meant to express
presentation, not program logic." What I would probably do is write a
custom get_data template tag and have that also take care of the caching.
Your template tag can call `template.render()`. See
TicketClosingReasons/UseSupportChannels for places to get help if needed.
If you disagree with my assessment, you can write to the
DevelopersMailingList to get other opinions.
--
Ticket URL: <https://code.djangoproject.com/ticket/29562#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/069.510d01ab719241ece8c9d0f367d28eaf%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.