Opened 11 years ago

Closed 11 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: master
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


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)

template_cache.diff (2.0 KB) - added by novoya 11 years ago.

Download all attachments as: .zip

Change History (2)

Changed 11 years ago by novoya

Attachment: template_cache.diff added

comment:1 Changed 11 years ago by dc

Resolution: duplicate
Status: newclosed

Duplicate of #9874

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