Opened 15 years ago

Closed 15 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)

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

Download all attachments as: .zip

Change History (2)

by novoya, 15 years ago

Attachment: template_cache.diff added

comment:1 by dc, 15 years ago

Resolution: duplicate
Status: newclosed

Duplicate of #9874

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