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
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
File details
Details for the file djld-1.0.0.tar.gz
.
File metadata
-
Download URL: djld-1.0.0.tar.gz
- Upload date:
-
Size: 3.7 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
Hashes for djld-1.0.0.tar.gz
Algorithm |
Hash digest |
|
SHA256 |
c7707231859efc055b50943dc35f10a562b1d3a56934c16cac9248540aa27e99
|
|
MD5 |
304ed3bf9668a8df8b956838cf883c34
|
|
BLAKE2b-256 |
7e1c496ae6e9a0d32f8e0eeb78759872b80f861c1cd8d54fb04311ec36e1f408
|
|
See more details on using hashes here.
File details
Details for the file djld-1.0.0-py3-none-any.whl
.
File metadata
-
Download URL: djld-1.0.0-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
Hashes for djld-1.0.0-py3-none-any.whl
Algorithm |
Hash digest |
|
SHA256 |
927967dc3840090eccded6002532550669a0ac905d7ac3312bd5ab79f3e77369
|
|
MD5 |
41d2495b4ed1ff929ebcc224452ebd08
|
|
BLAKE2b-256 |
f28c29c19960606eacff39e28ef25b3253934b0e11416d12338c220a8f2ea7e5
|
|
See more details on using hashes here.