Closed kylemacfarlane closed 8 years ago
I like the look of this and will definitely add it. If you have some working code could you make a pull request? If not I will have a crack.
I was just playing around with the code.
I think I might have overridden the wrong method. Environment.compile
compiles the template whereas Template.render
actually renders it.
This seems like it'd be harder than first thought. Jinja compiles together templates and so you lose visibility of includes.
You'd probably need to inject some kind of custom template tag (global function in Jinja) to record timings. Such a tag would probably be useful in regular Django templates too.
Or there could be a way to hook into Jinja to insert hooks before and after template includes while compiling, I'm not sure how hard that would be On 13 Feb 2014 03:30, "Kyle MacFarlane" notifications@github.com wrote:
This seems like it'd be harder than first thought. Jinja compiles together templates and so you lose visibility of includes.
You'd probably need to inject some kind of custom template tag (global function in Jinja) to record timings. Such a tag would probably be useful in regular Django templates too.
Reply to this email directly or view it on GitHubhttps://github.com/orf/django-debug-toolbar-template-timings/issues/20#issuecomment-34945240 .
Bumping - any chance of getting Jinja2 support? (I'd love the feature!)
as django now officially supports jinja2 template backend
Still no support for jinja 2 ?
Hi, this plugin was written by me a long time ago to fill a particular need. I open sourced it and it seems it became moderately popular, but I haven't used it in 3+ years.
If anyone wants to step in and add this feature, or work on it in any way, then I will always review and merge suitable PRs. Until them I'm afraid I don't have the time or the energy to add this.
I was pretty surprised at how slow the Django templates could get. I popped in some Jinga templates using django-jinga and saw 2300ms drop to 290ms. However I couldn't see it yet in the panel.
It was pretty easy to wrap the basic Jinga rendering but I'm not sure about wrapping blocks.
The import:
The new name getter (pass in the
args
andkwargs
fromtiming_hook
).The wrapper:
Also I was surprised at how plug and play django-jinga is and the immediate results. It uses a middleware to redirect all templates ending with e.g "j.html" to Jinga and so you don't have to redo all your templates at once.