Opened 17 years ago
Closed 17 years ago
#9873 closed (duplicate)
Template reuse is worthless(when inheretiance or inclusion involved) because parent templates get re-compiled every time
| Reported by: | novoya | Owned by: | nobody |
|---|---|---|---|
| Component: | Template system | Version: | dev |
| Severity: | Keywords: | template cache | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
The following view module fails to make good reuse to the template
For each new request, all inherited/included templates will be recreated and compiled
tpl = loader.get_template('mytemplate.html')
def view_func1(request):
'''
Any inherited templates from tpl
will created and recompiled again and again
'''
return HttpResponse(tpl.render(context))
Attached a very simple patch to solve the problem:
1.Simple template caching in the django.template.loader
2.Minimum change in django.template.loader_tags
Attachments (1)
Change History (2)
by , 17 years ago
| Attachment: | template_cache.diff added |
|---|
comment:1 by , 17 years ago
| Resolution: | → duplicate |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Duplicate of #9874