{"id":15432971,"url":"https://github.com/simonw/datasette-edit-templates","last_synced_at":"2025-04-19T17:51:59.026Z","repository":{"id":59338615,"uuid":"308930118","full_name":"simonw/datasette-edit-templates","owner":"simonw","description":"Plugin allowing Datasette templates to be edited within Datasette","archived":false,"fork":false,"pushed_at":"2024-02-07T16:44:31.000Z","size":105,"stargazers_count":4,"open_issues_count":3,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-18T07:53:37.077Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/simonw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-31T16:58:29.000Z","updated_at":"2024-04-11T19:24:18.000Z","dependencies_parsed_at":"2024-01-17T02:24:55.730Z","dependency_job_id":"72a1928a-453c-475b-835e-7213d4479e2a","html_url":"https://github.com/simonw/datasette-edit-templates","commit_stats":{"total_commits":36,"total_committers":1,"mean_commits":36.0,"dds":0.0,"last_synced_commit":"58fff7c9d92c9a597f8f40ccdcb6be5f9b05ff70"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonw%2Fdatasette-edit-templates","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonw%2Fdatasette-edit-templates/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonw%2Fdatasette-edit-templates/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonw%2Fdatasette-edit-templates/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simonw","download_url":"https://codeload.github.com/simonw/datasette-edit-templates/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249753088,"owners_count":21320664,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-01T18:29:52.557Z","updated_at":"2025-04-19T17:51:58.987Z","avatar_url":"https://github.com/simonw.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# datasette-edit-templates\n\n[![PyPI](https://img.shields.io/pypi/v/datasette-edit-templates.svg)](https://pypi.org/project/datasette-edit-templates/)\n[![Changelog](https://img.shields.io/github/v/release/simonw/datasette-edit-templates?include_prereleases\u0026label=changelog)](https://github.com/simonw/datasette-edit-templates/releases)\n[![Tests](https://github.com/simonw/datasette-edit-templates/workflows/Test/badge.svg)](https://github.com/simonw/datasette-edit-templates/actions?query=workflow%3ATest)\n[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/datasette-edit-templates/blob/main/LICENSE)\n\nPlugin allowing Datasette templates to be edited within Datasette.\n\n## Installation\n\nInstall this plugin in the same environment as Datasette.\n```bash\ndatasette install datasette-edit-templates\n```\n## Usage\n\nOn startup. a `_templates_` table will be created in the database you are running Datasette against.\n\nUse the app menu to navigate to the `/-/edit-templates` page, and edit templates there.\n\nChanges should become visible instantly, and will be persisted to your database.\n\nThe interface is only available to users with the `edit-templates` permission.\n\nThe `root` user is granted this permission by default. You can sign in as the root user using `datasette mydb.db --root`.\n\n## Configuration\n\nTo put the `_templates_` table in a specific database, set the `datasette-edit-templates: database` plugin configuration option:\n\n```json\n{\n    \"plugins\": {\n        \"datasette-edit-templates\": {\n            \"database\": \"some_database\"\n        }\n    }\n}\n```\nOn Datasette [1.0a5](https://docs.datasette.io/en/latest/changelog.html#a5-2023-08-29) or higher you can use the [internal database](https://docs.datasette.io/en/latest/internals.html#internals-internal) with `\"internal_db: true\":`\n\n```json\n{\n    \"plugins\": {\n        \"datasette-edit-templates\": {\n            \"internal_db\": true\n        }\n    }\n}\n```\n\nBy default the [prepare_jinja2_environment()](https://docs.datasette.io/en/stable/plugin_hooks.html#prepare-jinja2-environment-env-datasette) hook will be used to load the custom templates.\n\nYou can disable this behavior using the `skip_prepare_jinja2_environment` plugin configuration option:\n\n```json\n{\n    \"plugins\": {\n        \"datasette-edit-templates\": {\n            \"skip_prepare_jinja2_environment\": true\n        }\n    }\n}\n```\nSet this option if you want to further customize how the templates are loaded using another plugin.\n\nThe menu item used to access this plugin is labeled \"Edit templates\" by default. You can customize this using the `menu_label` plugin configuration option:\n\n```json\n{\n    \"plugins\": {\n        \"datasette-edit-templates\": {\n            \"menu_label\": \"Custom templates\"\n        }\n    }\n}\n```\nSet that to `null` to hide the menu option entirely.\n\n## Development\n\nTo set up this plugin locally, first checkout the code. Then create a new virtual environment:\n```bash\ncd datasette-edit-templates\npython3 -mvenv venv\nsource venv/bin/activate\n```\nOr if you are using `pipenv`:\n```bash\npipenv shell\n```\nNow install the dependencies and tests:\n```bash\npip install -e '.[test]'\n```\nTo run the tests:\n```bash\npytest\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonw%2Fdatasette-edit-templates","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimonw%2Fdatasette-edit-templates","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonw%2Fdatasette-edit-templates/lists"}