Wykres commitów

523 Commity (28872a1fa789f314b0342f4e6182f1c78d6e2bca)

Autor SHA1 Wiadomość Data
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 bfb19e3a17 Correctly escape sort-by columns in SQL (refs #189) 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 29f9a29250 Total row count now correct even if _next= applied 2018-04-08 22:10:22 -07:00
Simon Willison b2188f0442
Use .custom_sql() for _group_count implementation (refs #150) 2018-04-08 08:43:45 -07:00
Ryan Pitts 446d47fdb0 make html title more readable in query template (#180)
tiny tweak to make this easier to visually parse—I think it matches your style in other templates
2018-04-03 08:24:04 -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 0e5f51adfe
Three more news items 2018-03-30 00:03:45 -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 012fc7c5cd
Fix for FTS virtual table counting error 2018-03-20 18:26:04 -07:00
Simon Willison 56623e48da
News: Datasette Publish 2018-01-17 07:50:10 -08:00
Tony Hirst 3a56a2cd7e Add metadata, if it exists, to heroku temp dir (#178) 2018-01-14 13:05:16 -08:00
Simon Willison cac32b0ec4
Initial documentation for pagination 2018-01-09 20:47:03 -08:00
Simon Willison e63f432fe5
Mention Heroku in docs index page 2018-01-09 20:46:34 -08:00
Simon Willison 306e1c6ac4
Broke up test_app into test_api and test_html 2017-12-15 04:08:24 -08:00
Simon Willison 1aad396c9e
Fixed bug with .json path regular expression
I had a table called "geojson" and it caused an exception because the regex
was matching .json and not \.json
2017-12-12 21:36:03 -08:00
Simon Willison 4f08fc092f
Updated news 2017-12-12 08:52:19 -08:00
Simon Willison 702829f808
Added Datasette 0.14: customization edition to news 2017-12-09 18:10:30 -08:00
Simon Willison 68a34bc222
Deploy to Heroku with Python 3.6.3
Heroku deploys are currently showing the following warning:

    The latest version of Python 3 is python-3.6.3 (you are using python-3.6.2, which is unsupported).
    We recommend upgrading by specifying the latest version (python-3.6.3).
2017-12-09 18:01:17 -08:00
Simon Willison 2edc652df6
Releasing v0.14 2017-12-09 17:33: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 7db790fbf9
Release notes for 0.14
Also updated "datasette serve" help in getting started docs.
2017-12-09 17:26:32 -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 3f2fed1093
Fixed bug with HTML labels
loop.counter is incorrect - loop.index outputs the correct loop value.
2017-12-09 13:57:36 -08:00
Simon Willison 7126d08f10
HTML comment showing which templates were considered for a page
Closes #171
2017-12-09 13:47:32 -08:00
Simon Willison 3c9f889715
Custom templates for canned queries
Closes #170
2017-12-09 13:34:46 -08:00
Simon Willison 6bdfcf6076
Added Heroku to README, updated --help output examples
Refs #157
2017-12-09 10:50:08 -08:00
Simon Willison 06645f2e26
Formatting tweak 2017-12-09 10:41:20 -08:00
Simon Willison 1c0d93c39b
Fix Python 3.5 test failure 2017-12-09 10:39:19 -08:00
Simon Willison b01304d707
Updated tests I broke in c195ee4 2017-12-09 10:39:19 -08:00
Simon Willison 3459ab9166
Formatting fixes 2017-12-09 10:33:14 -08:00
Simon Willison c195ee4d46
package and publish commands now accept --static and --template-dir
Example usage:

    datasette package --static css:extra-css/ --static js:extra-js/ \
    	sf-trees.db --template-dir templates/ --tag sf-trees --branch master

This creates a local Docker image that includes copies of the templates/,
extra-css/ and extra-js/ directories. You can then run it like this:

	docker run -p 8001:8001 sf-trees

For publishing to Zeit now:

	datasette publish now --static css:extra-css/ --static js:extra-js/ \
		sf-trees.db --template-dir templates/ --name sf-trees --branch master

Example: https://sf-trees-wbihszoazc.now.sh/sf-trees-02c8ef1/Street_Tree_List

For publishing to Heroku:

	datasette publish heroku --static css:extra-css/ --static js:extra-js/ \
		sf-trees.db --template-dir templates/ --branch master

Closes #157, #160
2017-12-09 10:28:49 -08:00
Simon Willison 2cc14a236c
Ditched short form options for --static and --template-dir
The -t clashes with the package --tag option
2017-12-08 19:47:50 -08:00
Simon Willison 16dfccb1c5
Include sha1 hash in /static/app.css URL
This means that when Datasette's CSS changes the new CSS will be loaded
even though browsers may have cached the previous version.

Closes #154
2017-12-08 19:10:09 -08:00
Simon Willison 446f4b8322
Upgrade to Sanic 0.7.0 (#168)
https://github.com/channelcat/sanic/releases/tag/0.7.0
2017-12-08 19:00:33 -08:00
Simon Willison 61e3c5a1e9
Removed rogue print statement, refs #141 2017-12-08 08:08:00 -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 9af2964f6f
Documentation for metadata.json and "datasette skeleton" command
http://datasette.readthedocs.io/en/latest/metadata.html

Closes #166
2017-12-07 09:19:35 -08:00
Simon Willison 0539905806
Renamed "datasette build" command to "datasette inspect"
Closes #130
2017-12-07 08:57:31 -08:00
Simon Willison 80bf3afa43
metadata.json support for per-table/per-database metadata
Also added support for descriptions and HTML descriptions.

Here's an example metadata.json file illustrating custom per-database and per-
table metadata:

    {
        "title": "Overall datasette title",
        "description_html": "This is a <em>description with HTML</em>.",
        "databases": {
            "db1": {
                "title": "First database",
                "description": "This is a string description & has no HTML",
                "license_url": "http://example.com/",
        		"license": "The example license",
                "queries": {
                	"canned_query": "select * from table1 limit 3;"
                },
                "tables": {
                    "table1": {
                        "title": "Custom title for table1",
                        "description": "Tables can have descriptions too",
                        "source": "This has a custom source",
                        "source_url": "http://example.com/"
                    }
                }
            }
        }
    }

Closes #165, Refs #164
2017-12-07 08:47:07 -08:00
Simon Willison 515eaa8ccb
--reload now reloads on metadata changes too 2017-12-07 08:42:28 -08:00
Simon Willison 32cf5a4a72
New datasette skeleton command for generating metadata.json
Closes #164
2017-12-06 22:20:37 -08:00
Simon Willison 7e1ba161ec
Ability to easily customize _rows_and_columns.html per database table
Also added documentation for this.

Refs #158, Closes #159.
2017-12-06 22:11:22 -08:00