django-jsonschema converts Django Forms into JSON Schema compatibile representations
Project description
Introduction
django-jsonschema converts Django Forms into JSON Schema compatibile representations
Requirements
Python 2.6 or later
Django 1.4 or later
Usage
To convert a form to a JSON Schema:
from djangojsonschema.jsonschema import DjangoFormToJSONSchema schema_repr = DjangoFormToJSONSchema().convert_form(MyForm)
To embed a JSON Schema as a form field:
from djangojsonschema.forms import JSONSchemaField #where schema is a python dictionay like schema_repr in the first exmaple class MyForm(forms.Form): subfield = JSONSchemaField(schema=schema) form = MyForm(data={'subfield':'<json encoded value>'}) form.validate() #will validate the subfield entry against schema form['subfield'].as_widget() #will render a textarea widget with a data-schemajson attribute
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
File details
Details for the file django-jsonschema-0.2.0.tar.gz
.
File metadata
- Download URL: django-jsonschema-0.2.0.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9151cb70d031dcd2d53a7f0dfc8c2a20ec3bef5be8fa78cce18b42d27cdce54 |
|
MD5 | 3802d4aa6aa10b8fc2603468c8680de3 |
|
BLAKE2b-256 | 902ad0aa5033df08ac913a04edc5c2670b6bf530a33551a0cf5de37646630c2a |
File details
Details for the file django-jsonschema-0.2.0.macosx-10.9-intel.exe
.
File metadata
- Download URL: django-jsonschema-0.2.0.macosx-10.9-intel.exe
- Upload date:
- Size: 69.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 559c3cbf03fa0e725e392cd81832d43113693f58859b0a8238938129cb158214 |
|
MD5 | 63691722cbb8971ba86bec1a4e1a6a02 |
|
BLAKE2b-256 | be5a3cbf44bb3315893e6e03f60763059c7b09d41189a82c7cd1e81fae35e2ac |