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.

Files for djld, version 1.0.2
Filename, size File type Python version Upload date Hashes
Filename, size djld-1.0.2-py3-none-any.whl (5.0 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size djld-1.0.2.tar.gz (3.8 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page