jazzband / django-debug-toolbar

A configurable set of panels that display various debug information about the current request/response.
https://django-debug-toolbar.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
8.07k stars 1.05k forks source link

Actually use the Jinja2 template backend #1882

Closed matthiask closed 2 months ago

matthiask commented 7 months ago

Refs #1881.

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. Your commit message should include this information as well.

Fixes # (issue)

Checklist:

tim-schilling commented 7 months ago

I pushed this forward for the next person. Here's my message from the last commit:

It instruments the single template render, but not the inherited templates and I'm guessing not the included templates either. I suspect we're going to have to patch jinja templates more robustly than relying on the django jinja backend template class.

matthiask commented 5 months ago

@tim-schilling It would be great if we were able to inspect all of Jinja2's rendering but maybe that's harder because of Jinja2's template compilation, or what do you think? I didn't do much research here, so I'm basically just speculating.

I think what we have with your changes is already much better than the status quo. We could merge this, document the limitations and move on?

AlexCLeduc commented 3 months ago

For what it's worth, this patch on its own would be very useful for my jinja projects. I very rarely use the toolbar to inspect parents/included templates.

matthiask commented 3 months ago

@tim-schilling Do you have any reservations against merging this as it is, since it's more useful than the status quo?

tim-schilling commented 3 months ago

No, it is better. I'd prefer to document the caveat better for sure, but if it helps others that's still a win.

tim-schilling commented 2 months ago

@matthiask this is ready for your review. I don't think you'll be able to give it a green checkmark since you opened the PR.

tim-schilling commented 2 months ago

I'm going to assume your previous comments were tacit approval. I'm about to head out for the day and I'd like to get this in for 4.4.4 with #1946

matthiask commented 2 months ago

Thank you! I'm late to the party today.