Sure, below is the tag which I use for including a template.  The
template which is included is cached by my caching mechanism.

I've just noticed that the caching mechanism only caches the innermost
template in the inheritance tree.  So the templates from which I
inherit are reparsed at each request. Any idea how to cache everything?

    def render(self, context):
        #print "*"*10, 'render', self.vars
        if len(self.vars) == 4:
            pkg = resolve_variable(self.vars[0], context)
            model = resolve_variable(self.vars[1], context)
            tmpl_name = "%s/%s_%s" % (pkg, model, self.vars[2])
            #print "8"*10, "Probuja ladowac %s z %s"  % (tmpl_name,
context, )
            t = template_loader.get_template(tmpl_name)
            context['render_obj'] = resolve_variable(self.vars[3],
context)
        else:
            t = template_loader.get_template(self.vars[0])
            context['render_obj'] = resolve_variable(self.vars[1],
context)
        return t.render(context)

Reply via email to