Structured data with Django
Project description
Structured data with Django
Installation
pip install djld
Configuration
Add djld to your INSTALLED_APPS in settings.py, you can specify the folder containing your structured data overriding the LD_JSON_PATH variable
Usage
To render structured data in your templates you need the structured_data template tag
{% load djld %}
{% structured_data 'mydata.json' %}
You can use Django template sintax in your json files, and pass a context to the template tag
render(request, 'myapp/index.html', {
'user_data' : {
'url' : 'https://lotrek.it',
'name' : 'Human Before Digital'
}
})
{% load djld %}
{% structured_data 'mydata.json' user_data %}
You can also render a structured data from a dictionary, without using templates
render(request, 'myapp/index.html', {
'user_data' : {
'url' : 'https://lotrek.it',
'name' : 'Human Before Digital'
}
})
{% load djld %}
{% structured_data user_data %}
Run tests
$ pip install -r requirements-dev.txt
$ make test
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
djld-1.0.2.tar.gz
(3.8 kB
view details)
Built Distribution
djld-1.0.2-py3-none-any.whl
(5.0 kB
view details)
File details
Details for the file djld-1.0.2.tar.gz
.
File metadata
- Download URL: djld-1.0.2.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/18.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c53c97612f701a39ac80e544d65e114cf112b30c168c41d9420e7750ce20c7c |
|
MD5 | 7e453929da0918c9e98c554c33982f13 |
|
BLAKE2b-256 | d43089f3ad93427a4a4d2bf2ccd434da2205d0fdc8f5bd4c565ef8e088443539 |
File details
Details for the file djld-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: djld-1.0.2-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/18.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1060bc8826f0960523be4949ca6718156d9268d0dd2c2fc8b3eee08d90262d7 |
|
MD5 | f6e0827e744c346b49c1d28b2eff16db |
|
BLAKE2b-256 | 515ff98b67398ad09c6f58ef23dca10d533e36092f845d83214f9e3480174017 |