Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jinja2 Support Broken #1881

Open
ae99 opened this issue Feb 12, 2024 · 1 comment
Open

Jinja2 Support Broken #1881

ae99 opened this issue Feb 12, 2024 · 1 comment

Comments

@ae99
Copy link

ae99 commented Feb 12, 2024

Hey! Spent some time trying to get Jinja2 templates to appear in the debug toolbar correctly. Templates tab was simply saying "No Templates". This had me stumped as there's a test case for this in the codebase.

Upon some further digging, I think the Jinja2 test in tests/templates/jinja2/basic.jinja is actually being rendered as a Django template, not through Jinja 2. Modifying that template to contain:

{% extends 'base.html' %}
{% block content %}Test for {{ title }} (Jinja)
{% for i in range(10) %}{{ i }}{% endfor %}
{% endblock %}

Causes the test to fail with Django throwing django.template.exceptions.TemplateSyntaxError - even though this is valid Jinja and Django's template shouldn't be involved, so this test isn't actually using Jinja2.


It appears if you are using Jinja2 to render templates, DDT isn't able to pick up what goes on inside them, at least with default configurations. Any pointers on how I could get this working for myself would be great!

@matthiask
Copy link
Member

That's surprising! We should definitely add some Jinja2-only syntax to the basic.jinja template.

I did some work here #1882 but yeah, it seems that the tracking is broken. I wonder when that happened!

matthiask added a commit that referenced this issue Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants