Wykres commitów

31 Commity (main)

Autor SHA1 Wiadomość Data
Simon Willison e088abdb46 Refactored action menus to a shared include, closes #2301 2024-03-12 16:35:34 -07:00
Simon Willison b8711988b9 row_actions() plugin hook, closes #2299 2024-03-12 16:16:05 -07:00
Simon Willison c3caf36af7
Template slot family of plugin hooks - top_homepage() and others
New plugin hooks:

top_homepage
top_database
top_table
top_row
top_query
top_canned_query

New datasette.utils.make_slot_function()

Closes #1191
2024-01-30 19:54:03 -08:00
Simon Willison 4535568f2c Fixed display of database color
Closes #2139, closes #2119
2023-08-10 22:16:19 -07:00
Simon Willison 78dad236df
check_visibility can now take multiple permissions into account
Closes #1829
2022-10-23 19:11:33 -07:00
Simon Willison 1a5e5f2aa9 Refactor breadcrumbs to respect permissions, refs #1831 2022-10-13 14:42:52 -07:00
Simon Willison 8d5779acf0 Refactored alternate_url_json mechanism, refs #1620, #1533 2022-02-02 13:32:47 -08:00
Simon Willison 3ef47a0896 Link rel=alternate header for tables and rows
Also added Access-Control-Expose-Headers: Link to --cors mode.

Closes #1533

Refs https://github.com/simonw/datasette-notebook/issues/2

LL#	metadata.json.1
2022-02-01 23:49:09 -08:00
Simon Willison a37ee74891 Correct link to _ prefix on row page, closes #1525 2021-11-29 22:34:31 -08:00
Simon Willison 310c3a3e05 New datasette.urls URL builders, refs #904 2020-10-19 17:33:59 -07:00
Simon Willison c13d184704 Emergency fix for broken links in 0.50, closes #1010 2020-10-09 17:33:13 -07:00
Simon Willison 8f97b9b58e
datasette.client internal requests mechanism
Closes #943

* Datasette now requires httpx>=0.15
* Support OPTIONS without 500, closes #1001
* Added internals tests for datasette.client methods
* Datasette's own test mechanism now uses httpx to simulate requests
* Tests simulate HTTP 1.1 now
* Added base_url in a bunch more places
* Mark some tests as xfail - will remove that when new httpx release ships: #1005
2020-10-09 09:11:24 -07:00
Simon Willison d0c752d50c Fixed a couple of tiny HTML bugs, thanks curlylint
curlylint datasette/templates

https://github.com/thibaudcolas/curlylint
2020-09-07 08:43:37 -07:00
Simon Willison 7656fd64d8
base_url configuration setting, closes #394
* base_url configuration setting
* base_url works for static assets as well
2020-03-24 17:18:43 -07:00
Simon Willison a18e0964ec Refactor templates for better top nav customization, refs #540 2019-07-05 13:34:41 -07:00
Simon Willison e7120d91f6 Rename _rows_and_columns.html to _table.html, refs #521 2019-07-02 20:23:05 -07:00
Russ Garrett cf406c0754 New plugin hook: register_output_renderer hook (#441)
Thanks @russss!

* Add register_output_renderer hook

This changeset refactors out the JSON renderer and then adds a hook and
dispatcher system to allow custom output renderers to be registered.

The CSV output renderer is untouched because supporting streaming
renderers through this system would be significantly more complex, and
probably not worthwhile.

We can't simply allow hooks to be called at request time because we need
a list of supported file extensions when the request is being routed in
order to resolve ambiguous database/table names. So, renderers need to
be registered at startup.

I've tried to make this API independent of Sanic's request/response
objects so that this can remain stable during the switch to ASGI. I'm
using dictionaries to keep it simple and to make adding additional
options in the future easy.

Fixes #440
2019-05-01 16:01:56 -07:00
Simon Willison 6f6d0ff2b4
URL hashing is now off by default - closes #418
Prior to this commit Datasette would calculate the content hash of every
database and redirect to a URL containing that hash, like so:

    https://v0-27.datasette.io/fixtures => https://v0-27.datasette.io/fixtures-dd88475

This assumed that all databases were opened in immutable mode and were not
expected to change.

This will be changing as a result of #419 - so this commit takes the first step
in implementing that change by changing this default behaviour. Datasette will
now only redirect hash-free URLs under two circumstances:

* The new `hash_urls` config option is set to true (it defaults to false).
* The user passes `?_hash=1` in the URL
2019-03-17 15:55:04 -07:00
Simon Willison f00137c8ac
Only apply responsive table CSS to .rows-and-columns 2018-05-20 10:45:01 -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 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 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
Simon Willison afbda9e210
All extra_head blocks now call super
This means you can provide a custom base.html template that populates
extra_head and any of the default child templates will still render content
you included in that block.

Refs #158
2017-12-06 21:58:42 -08:00
Simon Willison 8ab3a169d4
CSS styling hooks as classes on the body
Refs #153

Every template now gets CSS classes in the body designed to support custom
styling.

The index template (the top level page at /) gets this:

    <body class="index">

The database template (/dbname/) gets this:

    <body class="db db-dbname">

The table template (/dbname/tablename) gets:

    <body class="table db-dbname table-tablename">

The row template (/dbname/tablename/rowid) gets:

    <body class="row db-dbname table-tablename">

The db-x and table-x classes use the database or table names themselves IF
they are valid CSS identifiers. If they aren't, we strip any invalid
characters out and append a 6 character md5 digest of the original name, in
order to ensure that multiple tables which resolve to the same stripped
character version still have different CSS classes.

Some examples (extracted from the unit tests):

    "simple" => "simple"
    "MixedCase" => "MixedCase"
    "-no-leading-hyphens" => "no-leading-hyphens-65bea6"
    "_no-leading-underscores" => "no-leading-underscores-b921bc"
    "no spaces" => "no-spaces-7088d7"
    "-" => "336d5e"
    "no $ characters" => "no--characters-59e024"
2017-11-29 23:09:54 -08:00
Simon Willison 4b7596ee5c
Row page now resolves foreign keys
Closes #132
2017-11-23 13:51:16 -08:00
Simon Willison 6a007f6322 Row pages show incoming foreign key relationships 2017-11-17 19:15:49 -08:00
Simon Willison 26370b14d8 Handle table names with slashes in them
e.g. https://datasette-wdlexdiaoz.now.sh/fivethirtyeight-75d605c/bob-ross%2Felements-by-episode.csv?CABIN=1&BUSHES=1&CLOUDS=1
2017-11-12 15:17:00 -08:00
Simon Willison 2366a016f2 Added links to .json and .jsono representations
Closes #62
2017-11-11 14:40:44 -08:00
Simon Willison e4bf66d9b0 Added header with breadcrumbs and footer
Also cleaned up titles on various pages.

Closes #61
2017-11-11 12:36:20 -08:00
Simon Willison 7d81083d40 Implemented responsive tables, removed bootstrap
No need for all of bootstrap since we only need to style a few elements.

Implemented responsive table pattern from here:
https://css-tricks.com/responsive-data-tables/

Refs #16
2017-11-10 21:55:50 -08:00
Simon Willison e7e50875d3 Renamed to 'datasette' 2017-11-10 10:38:35 -08:00