Add your description here
Project description
Django Altair Express
A Django package that provides a reusable template tag for rendering Altair charts.
Installation
pip install django-altair-express
or with uv:
uv add django-altair-express
Add the application to your INSTALLED_APPS in settings.py:
INSTALLED_APPS = [
# ...
'django_altair_express',
]
Requirements for Vega
For the charts to render correctly, you must include the exact versions of the Vega, Vega-Lite, and Vega-Embed libraries in your HTML. Please add these scripts to your base template <head> or before the end of the <body>:
<!-- Exact required versions for compatibility -->
<script src="https://cdn.jsdelivr.net/npm/vega@5.30.0"></script>
<script src="https://cdn.jsdelivr.net/npm/vega-lite@5.21.0"></script>
<script src="https://cdn.jsdelivr.net/npm/vega-embed@6.26.0"></script>
Usage
In your Django view, create an Altair chart and pass it to the template context:
import altair as alt
from django.shortcuts import render
def my_view(request):
chart = alt.Chart(alt.Data(values=[{"x": 1, "y": 2}])).mark_point().encode(x='x:Q', y='y:Q')
return render(request, 'my_template.html', {'chart': chart})
In your template (my_template.html), load the template tags and use the render_altair tag:
{% load altair_express %}
<!DOCTYPE html>
<html>
<head>
<!-- Include Vega scripts here -->
</head>
<body>
<h1>My Chart</h1>
<!-- Renders the container and javascript for the chart -->
{% render_altair chart %}
</body>
</html>
The render_altair tag accepts:
- An Altair chart object (which implements
.to_json()) - A Python dictionary representing the Vega-Lite JSON specification
- A JSON string representing the Vega-Lite specification
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 django_altair_express-0.1.0.tar.gz.
File metadata
- Download URL: django_altair_express-0.1.0.tar.gz
- Upload date:
- Size: 2.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
59f39dac8a928691e12af1d01dca3e36f5c93584d31098c43f95e2caf08dbbf2
|
|
| MD5 |
39f00f21f817f514d5dfa6fadf579da1
|
|
| BLAKE2b-256 |
567111f20718210849cd2ecd6648bcc4ad5f063a5d7ae6ce7e694f40de1f6032
|
Provenance
The following attestation bundles were made for django_altair_express-0.1.0.tar.gz:
Publisher:
ci.yml on Xpt0xZv/django_altair_express
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_altair_express-0.1.0.tar.gz -
Subject digest:
59f39dac8a928691e12af1d01dca3e36f5c93584d31098c43f95e2caf08dbbf2 - Sigstore transparency entry: 1981079787
- Sigstore integration time:
-
Permalink:
Xpt0xZv/django_altair_express@aee40f34a4e2d97c7cf4b066bdfe04a8c894899f -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Xpt0xZv
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@aee40f34a4e2d97c7cf4b066bdfe04a8c894899f -
Trigger Event:
release
-
Statement type:
File details
Details for the file django_altair_express-0.1.0-py3-none-any.whl.
File metadata
- Download URL: django_altair_express-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
00bcab7f11151f8a26462e4a6ebd190e8be8b9bd463b3ae68777a0ad86640893
|
|
| MD5 |
b54809e36aba11a3d967c676766b9087
|
|
| BLAKE2b-256 |
af69386377e3bc28c3cc19df96ec374ae3fa6b09592b1d3f2e7c6a9d306f6a96
|
Provenance
The following attestation bundles were made for django_altair_express-0.1.0-py3-none-any.whl:
Publisher:
ci.yml on Xpt0xZv/django_altair_express
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_altair_express-0.1.0-py3-none-any.whl -
Subject digest:
00bcab7f11151f8a26462e4a6ebd190e8be8b9bd463b3ae68777a0ad86640893 - Sigstore transparency entry: 1981079928
- Sigstore integration time:
-
Permalink:
Xpt0xZv/django_altair_express@aee40f34a4e2d97c7cf4b066bdfe04a8c894899f -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Xpt0xZv
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@aee40f34a4e2d97c7cf4b066bdfe04a8c894899f -
Trigger Event:
release
-
Statement type: