Simon Willison
a4cc5dc813
New ?_shape=array option + tweaks to _shape, closes #245
...
* Default is now ?_shape=arrays (renamed from lists)
* New ?_shape=array returns an array of objects as the root object
* Changed ?_shape=object to return the object as the root
* Updated docs
2018-05-01 17:20:39 -07:00
Simon Willison
aa954382c3
FTS tables now detected by inspect(), closes #240
2018-04-28 17:04:32 -07:00
Simon Willison
f188ceaa2a
New ?_size=XXX querystring parameter for table view, closes #229
...
Also added documentation for all of the _special arguments.
Plus deleted some duplicate logic implementing _group_count.
2018-04-25 21:47:12 -07:00
Simon Willison
4504d5160b
If max_returned_rows==page_size, increment max_returned_rows
...
Fixes #230 , where if the two were equal pagination didn't work correctly.
2018-04-25 21:04:12 -07:00
Simon Willison
02ee31c8b4
New hidden: True option for table metadat, closes #239
2018-04-25 20:42:57 -07:00
Simon Willison
00ab954300
Added CSS class rows-and-columns to main table
2018-04-23 18:31:32 -07:00
Simon Willison
f3f4295712
label_column now defined on the table-being-linked-to, fixes #234
2018-04-22 13:46:18 -07:00
Simon Willison
f27cabbaf3
label_column option in metadata.json - closes #234
2018-04-22 10:53:16 -07:00
Simon Willison
b52171db1e
Plugins can now bundle custom templates, closes #224
...
Refs #14
2018-04-18 22:50:27 -07:00
Simon Willison
b55809a1e2
Added /-/metadata /-/plugins /-/inspect, closes #225
2018-04-18 22:25:22 -07:00
Simon Willison
404fa2252b
datasette publish/package --install option, closes #223
...
Allows you to specify one or more additional packages to be installed,
useful for deploying plugins.
2018-04-18 07:55:36 -07:00
Simon Willison
1c36d07dd4
New plugin hooks: extra_css_urls() and extra_js_urls()
...
Closes #214
2018-04-17 20:12:21 -07:00
Simon Willison
a5792a8c61
<th> now gets class="col-X" - plus added col-X documentation
...
Refs #209
2018-04-17 19:11:54 -07:00
Simon Willison
dfb87d012c
Use to_css_class for table cell column classes
...
This ensures that columns with spaces in the name will still
generate usable CSS class names. Refs #209
2018-04-17 18:19:21 -07:00
Russ Garrett
136a70d887
Add column name classes to <td>s, make PK bold
2018-04-17 18:13:02 -07:00
Russ Garrett
0f782dd8df
Additional test asserts
2018-04-17 18:13:02 -07:00
Simon Willison
aaf59db570
Longer time limit for test_paginate_compound_keys
...
It was failing intermittently in Travis - see #209
2018-04-17 18:09:48 -07:00
Simon Willison
e7c769ef30
Working implementation of #216 which passes the tests
...
Reverted commit 5364fa7f33
(where I removed the
code that didn't work).
Added primary keys to order-by clause for sorting to get tests to pass
2018-04-16 18:41:55 -07:00
Simon Willison
5364fa7f33
Revert #216 until I can get tests to pass in Travis
...
Revert "Fix for _sort_desc=sortable_with_nulls test, refs #216"
This reverts commit 07fc2d113e
.
Revert "Fixed #216 - paginate correctly when sorting by nullable column"
This reverts commit 2abe539a0f
.
2018-04-16 17:53:37 -07:00
Simon Willison
07fc2d113e
Fix for _sort_desc=sortable_with_nulls test, refs #216
2018-04-16 17:05:03 -07:00
Simon Willison
2abe539a0f
Fixed #216 - paginate correctly when sorting by nullable column
2018-04-16 16:52:50 -07:00
Simon Willison
b2955d9065
New --plugins-dir=plugins/ option ( #212 )
...
* New --plugins-dir=plugins/ option
New option causing Datasette to load and evaluate all of the Python files in
the specified directory and register any plugins that are defined in those
files.
This new option is available for the following commands:
datasette serve mydb.db --plugins-dir=plugins/
datasette publish now/heroku mydb.db --plugins-dir=plugins/
datasette package mydb.db --plugins-dir=plugins/
* Unit tests for --plugins-dir=plugins/
Closes #211
2018-04-15 22:22:01 -07:00
Simon Willison
dd4491dd81
Update number of expected tables
2018-04-14 08:16:54 -07:00
Simon Willison
6b15a53cd3
Unit test for unlabelled foreign keys from #207
2018-04-14 08:00:54 -07:00
Simon Willison
d72201e883
Added unit test for foreign key links in HTML
...
Needed to add a further unit test for #207
2018-04-14 07:55:27 -07:00
Russ Garrett
ed974417ad
Tests for unit filtering
2018-04-14 15:06:52 +01:00
Simon Willison
9f28bbe43d
Better mechanism for handling errors; 404s for missing table/database
...
New error mechanism closes #193
404s for missing tables/databesse closes #184
Makes pull request #202 unnecessary.
2018-04-13 11:17:22 -07:00
Simon Willison
46b237c29a
datasette inspect now finds primary_keys
...
Closes #195
2018-04-09 17:54:12 -07:00
Simon Willison
57b19f09d1
Ability to sort using form fields (for mobile portrait mode)
...
We now display sort options as a select box plus a descending checkbox, which
means you can apply sort orders even in portrait mode on a mobile phone where
the column headers are hidden.
Closes #199
2018-04-09 17:34:32 -07:00
Simon Willison
a290f28caa
table_rows => table_rows_count, filtered_table_rows => filtered_table_rows_count
...
Renamed properties. Closes #194
2018-04-08 22:24:24 -07:00
Simon Willison
c1d37fdf2b
Fixed bug with human filter description, refs #189
...
We were showing this:
201 rows where sorted by sortable_with_nulls
We now show this:
201 rows sorted by sortable_with_nulls
2018-04-08 22:10:22 -07:00
Simon Willison
b13f0986f2
New sortable_columns option in metadata.json to control sort options
...
You can now explicitly set which columns in a table can be used for sorting
using the _sort and _sort_desc arguments using metadata.json:
{
"databases": {
"database1": {
"tables": {
"example_table": {
"sortable_columns": [
"height",
"weight"
]
}
}
}
}
}
Refs #189
2018-04-08 22:10:22 -07:00
Simon Willison
a87df963a0
Error handling for ?_sort and ?_sort_desc
...
Verifies that they match an existing column, and only one or the other option
is provided - refs #189
Eses a new DatasetteError exception that closes #193
2018-04-08 22:10:22 -07:00
Simon Willison
747a801b50
Column headers now link to sort/desc sort - refs #189
2018-04-08 22:10:22 -07:00
Simon Willison
9f2ec39fbc
Current sort order now reflected in human filter description
...
Plus renamed human_description to human_description_en
Refs #189
2018-04-08 22:10:22 -07:00
Simon Willison
f3a3820ff5
_sort and _sort_desc parameters for table views
...
Allows for paginated sorted results based on a specified column.
Refs #189
2018-04-08 22:10:22 -07:00
Simon Willison
0abd3abacb
New ?_shape=objects/object/lists param for JSON API ( #192 )
...
New _shape= parameter replacing old .jsono extension
Now instead of this:
/database/table.jsono
We use the _shape parameter like this:
/database/table.json?_shape=objects
Also introduced a new _shape called 'object' which looks like this:
/database/table.json?_shape=object
Returning an object for the rows key:
...
"rows": {
"pk1": {
...
},
"pk2": {
...
}
}
Refs #122
2018-04-03 07:52:54 -07:00
Simon Willison
dd0566ff8e
Utility for writing test database fixtures to a .db file
...
python tests/fixtures.py /tmp/hello.db
This is useful for making a SQLite database of the test fixtures for
interactive exploration.
2018-04-03 06:46:11 -07:00
Simon Willison
8f0d44d646
escape_sqlite_table_name => escape_sqlite, handles reserved words
...
It can be used for column names as well as table names.
Reserved word list from https://www.sqlite.org/lang_keywords.html
2018-04-03 06:40:49 -07:00
Simon Willison
7365c3f51c
Compound primary key _next= now plays well with extra filters
...
Closes #190
2018-03-29 23:26:22 -07:00
Simon Willison
31f63d1672
Fixed bug with keyset pagination over compound primary keys
...
Closes #190
2018-03-29 22:11:02 -07:00
Simon Willison
89d9fbb91b
Database/Table views inherit source/license/source_url/license_url metadata
...
If you set the source_url/license_url/source/license fields in your root
metadata those values will now be inherited all the way down to the database
and table templates.
The title/description are NOT inherited.
Also added unit tests for the HTML generated by the metadata.
Refs #185
2018-03-27 09:18:32 -07:00
Simon Willison
306e1c6ac4
Broke up test_app into test_api and test_html
2017-12-15 04:08:24 -08:00
Simon Willison
ae94006809
No longer include database hash in hyperlinks
...
It was making the unit tests unreliable. Also we do not do that for foreign key links.
2017-12-09 17:31:08 -08:00
Simon Willison
794c3bfcfc
Cleaned up row/column display logic, fixed bug
...
Closes #167
2017-12-09 16:59:25 -08:00
Simon Willison
7a7e4b2ed8
Started unit tests for row/table HTML pages
...
Refs #167
Thanks to the new tests, spotted and fixed a bug where pages that were
supposed to have 100 things on them were actually displaying 101.
2017-12-09 15:32:54 -08:00
Simon Willison
b01304d707
Updated tests I broke in c195ee4
2017-12-09 10:39:19 -08:00
Simon Willison
cbfd6b745e
Publish should now work if /tmp is on different device
...
Fixes #141
2017-12-08 08:06:24 -08:00
Simon Willison
709f4f2798
Fixed bug with detecting FTS tables
...
Closes #135
2017-12-06 20:54:37 -08:00
Simon Willison
0cfd7ce59d
Allow WITH query (previously we required SELECT at start)
...
Fixes #161
2017-12-03 20:51:31 -08:00