mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
parent
fcf43589eb
commit
81dea4b07a
8 changed files with 73 additions and 12 deletions
|
|
@ -43,6 +43,7 @@ EXPECTED_PLUGINS = [
|
|||
"extra_js_urls",
|
||||
"extra_template_vars",
|
||||
"forbidden",
|
||||
"load_template",
|
||||
"menu_links",
|
||||
"permission_allowed",
|
||||
"prepare_connection",
|
||||
|
|
|
|||
|
|
@ -308,3 +308,9 @@ def table_actions(datasette, database, table, actor):
|
|||
},
|
||||
{"href": datasette.urls.instance(), "label": "Table: {}".format(table)},
|
||||
]
|
||||
|
||||
|
||||
@hookimpl
|
||||
def load_template(template, request):
|
||||
if template == "show_json.html" and request.args.get("_special"):
|
||||
return "<h1>Special show_json: {{ filename }}</h1>"
|
||||
|
|
|
|||
|
|
@ -801,3 +801,8 @@ def test_hook_table_actions(app_client):
|
|||
{"label": "Database: fixtures", "href": "/"},
|
||||
{"label": "Table: facetable", "href": "/"},
|
||||
]
|
||||
|
||||
|
||||
def test_hook_load_template(app_client):
|
||||
response = app_client.get("/-/databases?_special=1")
|
||||
assert response.text == "<h1>Special show_json: databases.json</h1>"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue