Skip to main content

Structured data with Django

Project description

Structured data with Django

Latest Version codecov Build Status License: MIT

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


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.1.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

djld-1.0.1-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file djld-1.0.1.tar.gz.

File metadata

  • Download URL: djld-1.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 2fd003cde469c04604b2fe76ac5685706490a0453e11783b06a16291732c72ce
MD5 b2f810957be05215957b08d1d0e4a0e5
BLAKE2b-256 55d1b3144544dd1e4927b906b3076b6224f743ec2445cd82de5eba4376798969

See more details on using hashes here.

File details

Details for the file djld-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: djld-1.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 deebace8a2649e7ad4bc1d6102d54d0397e6243fbcdae2e6fa0dfebe953380cb
MD5 38d7b689df6bc1add9cc609891ce4bec
BLAKE2b-256 05954bda8b80ff9cf3bb55689b09b311f51c1618c1be01e682c75dcc09ba1c3e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page