mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Improved UI for CSV/JSON export, closes #266
This commit is contained in:
parent
fc3660cfad
commit
83f4ef7ec7
7 changed files with 78 additions and 14 deletions
|
|
@ -382,6 +382,12 @@ class BaseView(RenderMixin):
|
|||
url_labels_extra = {}
|
||||
if data.get("expandable_columns"):
|
||||
url_labels_extra = {"_labels": "on"}
|
||||
url_csv_args = {
|
||||
"_size": "max",
|
||||
**url_labels_extra
|
||||
}
|
||||
url_csv = path_with_format(request, "csv", url_csv_args)
|
||||
url_csv_path = url_csv.split('?')[0]
|
||||
context = {
|
||||
**data,
|
||||
**extras,
|
||||
|
|
@ -389,15 +395,9 @@ class BaseView(RenderMixin):
|
|||
"url_json": path_with_format(request, "json", {
|
||||
**url_labels_extra,
|
||||
}),
|
||||
"url_csv": path_with_format(request, "csv", {
|
||||
"_size": "max",
|
||||
**url_labels_extra
|
||||
}),
|
||||
"url_csv_dl": path_with_format(request, "csv", {
|
||||
"_dl": "1",
|
||||
"_size": "max",
|
||||
**url_labels_extra
|
||||
}),
|
||||
"url_csv": url_csv,
|
||||
"url_csv_path": url_csv_path,
|
||||
"url_csv_args": url_csv_args,
|
||||
"extra_css_urls": self.ds.extra_css_urls(),
|
||||
"extra_js_urls": self.ds.extra_js_urls(),
|
||||
"datasette_version": __version__,
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ from datasette.utils import (
|
|||
CustomRow,
|
||||
Filters,
|
||||
InterruptedError,
|
||||
append_querystring,
|
||||
compound_keys_after_sql,
|
||||
escape_sqlite,
|
||||
filters_should_redirect,
|
||||
|
|
@ -748,6 +749,7 @@ class TableView(RowTableShared):
|
|||
"is_sortable": any(c["sortable"] for c in display_columns),
|
||||
"path_with_replaced_args": path_with_replaced_args,
|
||||
"path_with_removed_args": path_with_removed_args,
|
||||
"append_querystring": append_querystring,
|
||||
"request": request,
|
||||
"sort": sort,
|
||||
"sort_desc": sort_desc,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue