Skip to main content

datasette-edit-templates

PyPI Changelog Tests License

Plugin allowing Datasette templates to be edited within Datasette.

Installation

Install this plugin in the same environment as Datasette.

datasette install datasette-edit-templates

Usage

On startup. a _templates_ table will be created in the database you are running Datasette against.

Use the app menu to navigate to the /-/edit-templates page, and edit templates there.

Changes should become visible instantly, and will be persisted to your database.

The interface is only available to users with the edit-templates permission.

The root user is granted this permission by default. You can sign in as the root user using datasette mydb.db --root.

Configuration

To put the _templates_ table in a specific database, set the datasette-edit-templates: database plugin configuration option:

{
    "plugins": {
        "datasette-edit-templates": {
            "database": "some_database"
        }
    }
}

On Datasette 1.0a5 or higher you can use the internal database with "internal_db: true":

{
    "plugins": {
        "datasette-edit-templates": {
            "internal_db": true
        }
    }
}

By default the prepare_jinja2_environment() hook will be used to load the custom templates.

You can disable this behavior using the skip_prepare_jinja2_environment plugin configuration option:

{
    "plugins": {
        "datasette-edit-templates": {
            "skip_prepare_jinja2_environment": true
        }
    }
}

Set this option if you want to further customize how the templates are loaded using another plugin.

The menu item used to access this plugin is labeled "Edit templates" by default. You can customize this using the menu_label plugin configuration option:

{
    "plugins": {
        "datasette-edit-templates": {
            "menu_label": "Custom templates"
        }
    }
}

Set that to null to hide the menu option entirely.

Development

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

cd datasette-edit-templates
python3 -mvenv venv
source venv/bin/activate

Or if you are using pipenv:

pipenv shell

Now install the dependencies and tests:

pip install -e '.[test]'

To run the tests:

pytest

Metadata

Release files for datasette-edit-templates 0.4.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for datasette-edit-templates 0.4.3
File Size Uploaded Provenance Actions
datasette-edit-templates-0.4.3.tar.gz 84.3 kB Without provenance Details for datasette-edit-templates-0.4.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for datasette-edit-templates 0.4.3
File Interpreter ABI Platform Actions
datasette_edit_templates-0.4.3-py3-none-any.whl Python 3 none any Details for datasette_edit_templates-0.4.3-py3-none-any.whl

Total release size: 167.3 kB

Release files / datasette-edit-templates-0.4.3.tar.gz

Download URL datasette-edit-templates-0.4.3.tar.gz
Size 84.3 kB
Tags Source
SHA-256 checksum
How to use checksums
ad34eb90235e08b9883ce4262875d1d07d7564119e1fb9321ef595b9fd484157
BLAKE2b-256 checksum
How to use checksums
9e8beb6de2d0dfb711e4374b6af88e2e371714c02ebc6b147a2f939a2f5447dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.7

Release files / datasette_edit_templates-0.4.3-py3-none-any.whl

Download URL datasette_edit_templates-0.4.3-py3-none-any.whl
Size 82.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6fcb5b400d8f8cde0eba2781bfab8ba444a457fed32176fed5d62dece7ed2e8e
BLAKE2b-256 checksum
How to use checksums
82d17c8ecd3d4f96c0637894ab64f363987c5b0533e336b5dcb328ab7f1c24d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.7

Security for datasette-edit-templates 0.4.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page