mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
71 lines
2.5 KiB
HTML
71 lines
2.5 KiB
HTML
{% extends "base.html" %}
|
|
|
|
{% block title %}{{ database }}{% endblock %}
|
|
|
|
{% block extra_head %}
|
|
{{ super() }}
|
|
{% include "_codemirror.html" %}
|
|
{% endblock %}
|
|
|
|
{% block body_class %}db db-{{ database|to_css_class }}{% endblock %}
|
|
|
|
{% block nav %}
|
|
<p class="crumbs">
|
|
<a href="/">home</a>
|
|
</p>
|
|
{{ super() }}
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
|
|
<h1 style="padding-left: 10px; border-left: 10px solid #{{ database_color(database) }}">{{ metadata.title or database }}</h1>
|
|
|
|
{% block description_source_license %}{% include "_description_source_license.html" %}{% endblock %}
|
|
|
|
{% if config.allow_sql %}
|
|
<form class="sql" action="{{ database_url(database) }}" method="get">
|
|
<h3>Custom SQL query</h3>
|
|
<p><textarea id="sql-editor" name="sql">{% if tables %}select * from {{ tables[0].name|escape_sqlite }}{% else %}select sqlite_version(){% endif %}</textarea></p>
|
|
<p><input type="submit" value="Run SQL"></p>
|
|
</form>
|
|
{% endif %}
|
|
|
|
{% for table in tables %}
|
|
{% if show_hidden or not table.hidden %}
|
|
<div class="db-table">
|
|
<h2><a href="{{ database_url(database) }}/{{ table.name|quote_plus }}">{{ table.name }}</a>{% if table.hidden %}<em> (hidden)</em>{% endif %}</h2>
|
|
<p><em>{% for column in table.columns[:9] %}{{ column }}{% if not loop.last %}, {% endif %}{% endfor %}{% if table.columns|length > 9 %}...{% endif %}</em></p>
|
|
<p>{% if table.count is none %}Many rows{% else %}{{ "{:,}".format(table.count) }} row{% if table.count == 1 %}{% else %}s{% endif %}{% endif %}</p>
|
|
</div>
|
|
{% endif %}
|
|
{% endfor %}
|
|
|
|
{% if hidden_count and not show_hidden %}
|
|
<p>... and <a href="{{ database_url(database) }}?_show_hidden=1">{{ "{:,}".format(hidden_count) }} hidden table{% if hidden_count == 1 %}{% else %}s{% endif %}</a></p>
|
|
{% endif %}
|
|
|
|
{% if views %}
|
|
<h2>Views</h2>
|
|
<ul>
|
|
{% for view in views %}
|
|
<li><a href="{{ database_url(database) }}/{{ view|urlencode }}">{{ view }}</a></li>
|
|
{% endfor %}
|
|
</ul>
|
|
{% endif %}
|
|
|
|
{% if queries %}
|
|
<h2>Queries</h2>
|
|
<ul>
|
|
{% for query in queries %}
|
|
<li><a href="{{ database_url(database) }}/{{ query.name|urlencode }}" title="{{ query.description or query.sql }}">{{ query.title or query.name }}</a></li>
|
|
{% endfor %}
|
|
</ul>
|
|
{% endif %}
|
|
|
|
{% if allow_download %}
|
|
<p class="download-sqlite">Download SQLite DB: <a href="{{ database_url(database) }}.db">{{ database }}.db</a> <em>{{ format_bytes(size) }}</em></p>
|
|
{% endif %}
|
|
|
|
{% include "_codemirror_foot.html" %}
|
|
|
|
{% endblock %}
|