Link to Datasette API docs from /-/api, refs #1871

This commit is contained in:
Simon Willison 2022-11-01 22:45:05 -07:00
commit 000eeb4464
3 changed files with 8 additions and 9 deletions

View file

@ -1100,6 +1100,7 @@ class Datasette:
),
"base_url": self.setting("base_url"),
"csrftoken": request.scope["csrftoken"] if request else lambda: "",
"datasette_version": __version__,
},
**extra_template_vars,
}

View file

@ -10,14 +10,13 @@
<h1>API Explorer</h1>
<p>Use this tool to try out the Datasette write API.</p>
{% if errors %}
{% for error in errors %}
<p class="message-error">{{ error }}</p>
{% endfor %}
{% endif %}
<p>Use this tool to try out the
{% if datasette_version %}
<a href="https://docs.datasette.io/en/{{ datasette_version }}/json_api.html">Datasette API</a>.
{% else %}
Datasette API.
{% endif %}
</p>
<details open style="border: 2px solid #ccc; border-bottom: none; padding: 0.5em">
<summary style="cursor: pointer;">GET</summary>
<form method="get" id="api-explorer-get" style="margin-top: 0.7em">

View file

@ -507,7 +507,6 @@ class DataView(BaseView):
if key not in ("_labels", "_facet", "_size")
]
+ [("_size", "max")],
"datasette_version": __version__,
"settings": self.ds.settings_dict(),
},
}