mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
HTML comment showing which templates were considered for a page
Closes #171
This commit is contained in:
parent
3c9f889715
commit
7126d08f10
3 changed files with 20 additions and 2 deletions
|
|
@ -45,10 +45,16 @@ connections = threading.local()
|
|||
|
||||
class RenderMixin(HTTPMethodView):
|
||||
def render(self, templates, **context):
|
||||
template = self.jinja_env.select_template(templates)
|
||||
select_templates = ['{}{}'.format(
|
||||
'*' if template_name == template.name else '',
|
||||
template_name
|
||||
) for template_name in templates]
|
||||
return response.html(
|
||||
self.jinja_env.select_template(templates).render({
|
||||
template.render({
|
||||
**context, **{
|
||||
'app_css_hash': self.ds.app_css_hash(),
|
||||
'select_templates': select_templates,
|
||||
}
|
||||
})
|
||||
)
|
||||
|
|
|
|||
|
|
@ -33,6 +33,6 @@
|
|||
{% endif %}{{ metadata.source or metadata.source_url }}{% if metadata.source_url %}</a>{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if select_templates %}<!-- Templates considered: {{ select_templates|join(", ") }} -->{% endif %}
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue