Expose the Datasette request object to custom templates
Project description
datasette-template-request
Expose the Datasette request object to custom templates
Installation
Install this plugin in the same environment as Datasette.
$ datasette install datasette-template-request
Usage
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: {{ request.args.name }}
Development
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:
pytest
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file datasette-template-request-0.1.tar.gz.
File metadata
- Download URL: datasette-template-request-0.1.tar.gz
- Upload date:
- Size: 2.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
37e1ce795d635ca8c9df72ccd1abb8704b062bcf39f3d8f5aa5edb9e1b136f66
|
|
| MD5 |
de29b7262f524bdda5570a73cbad41bd
|
|
| BLAKE2b-256 |
b86e6f35e338e6278c796c83eada47fd97c8c9b7cb3dced07029f091c82aff94
|
File details
Details for the file datasette_template_request-0.1-py3-none-any.whl.
File metadata
- Download URL: datasette_template_request-0.1-py3-none-any.whl
- Upload date:
- Size: 2.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
edce93be789ea7bbf37d97a3121cb69048dd9f3bfff341226043f02ad9a9a9d3
|
|
| MD5 |
80ced62425378b24a0ee1778118740ab
|
|
| BLAKE2b-256 |
db72b685ec634172c79e5ab4d04ee4f1369f47af40932aa3c74402708cd272e5
|