datasette icon indicating copy to clipboard operation
datasette copied to clipboard

multiple plugins extending the same base template?

Open epaulson opened this issue 8 months ago • 0 comments

I am trying to build my own plugin that will extend the table template, but I think I'm stuck on some sort of conflict with other plugins that also extend the table template, like the write-ui. Logged in as root with the write-ui plugin installed, I see an 'add new row' button on my table page.

Just as a test, I made a trivial template table.html in my plugin's template/ directory:

{% extends "default:table.html" %}

{% block content %}
<h1>TABLE EXTRA HTML AT THE TOP OF THE CONTENT BLOCK</h1>
<p>This line renders the original block:</p>
{{ super() }}
{% endblock %}

but if I have the datasette-write-ui plugin installed, I don't see the TABLE EXTRA HTML text.

However, even with the datasette-write-ui plugin installed, if I have a row.html file in my plugin's template/ directory, this works:

{% extends "default:row.html" %}

{% block content %}
<h1>ROW EXTRA HTML AT THE TOP OF THE CONTENT BLOCK</h1>
<p>This line renders the original block:</p>
{{ super() }}
{% endblock %}

If I uninstall datasette-write-ui, then I see my trivial table template.

If I then reinstall the datasette-write-ui plugin, this time I still see the TABLE EXTRA HTML text but the 'Add new row' button is not rendered. If I remove the table.html file from my plugins templates/ directory without making any other changes, then the 'Add new row' button returns.

For now it's not a big deal for me, I just won't have the write-ui plugin installed while I'm using my plugin, but if there's something better I can do so my plugin can coexist with other plugins, I would appreciate any direction you can point me.

epaulson avatar Jun 18 '24 18:06 epaulson