datasette-template-request by simonw

31 downloads this week        Star

README source code


PyPI Changelog Tests License

Expose the Datasette request object to custom templates


Install this plugin in the same environment as Datasette.

$ datasette install datasette-template-request


Once this plugin is installed, Datasette custom templates can use {{ request }} to access the current request object. For example, to access ?name=Cleo in the query string a template could use this:

Name: {{ }}


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

cd datasette-template-request
python3 -mvenv venv
source venv/bin/activate

Or if you are using pipenv:

pipenv shell

Now install the dependencies and test dependencies:

pip install -e '.[test]'

To run the tests: