-
-
Notifications
You must be signed in to change notification settings - Fork 813
Closed
Description
I tried using this block of template in a plugin and got an error:
{% block nav %}
<p class="crumbs">
<a href="{{ base_url }}">home</a> /
<a href="{{ database_url(database) }}">{{ database }}</a> /
<a href="{{ database_url(database) }}/{{ table|quote_plus }}">{{ table }}</a>
</p>
{{ super() }}
{% endblock %}Error: 'database_url' is undefined
That's because database_url is only made available by the BaseView template here:
datasette/datasette/views/base.py
Lines 110 to 125 in d6e03b0
| async def render(self, templates, request, context=None): | |
| context = context or {} | |
| template = self.ds.jinja_env.select_template(templates) | |
| template_context = { | |
| **context, | |
| **{ | |
| "database_url": self.database_url, | |
| "database_color": self.database_color, | |
| "select_templates": [ | |
| "{}{}".format( | |
| "*" if template_name == template.name else "", template_name | |
| ) | |
| for template_name in templates | |
| ], | |
| }, | |
| } |
Reactions are currently unavailable