datasette-write-ui by datasette

309 downloads this week        Star

README source code

datasette-write-ui

PyPI Changelog Tests License

A Datasette plugin that adds UI elements to edit, insert, or delete rows in SQLite tables.

Installation

This plugin requires the alpha version of Datasette 1.0. You can install it with:

pip install datasette==1.0a3

After that, you can install this plugin in the same environment as Datasette.

datasette install datasette-write-ui

Usage

Once installed, the new UI elements will appear on the table page. You'll need special permission in order to see them. The easiest way is to use the root user, or otherwise use a custom actor.

If you actor has the insert-row permissions, you'll see the "Insert new row" button at the bottom of the page.

If your actor has the update-row permissions, you'll see a new "Edit row" option in a new menu on each row.

If your actor has the delete-row permissions, you'll see a new "Delete row" option in a new menu on each row.

Development

To set up this plugin locally, first checkout the code. Then create a new virtual environment:

cd datasette-write-ui
python3 -m venv venv
source venv/bin/activate

Now install the dependencies and test dependencies:

pip install -e '.[test]'

To install the JavaScript build dependencies, run this:

npm install

You can use the Just command runner to build the TypeScript to minified JavaScript like this:

just js

To run the tests:

pytest