Skip to main content
Help us improve Python packaging – donate today!

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

Release history Release notifications

This version
History Node

0.2.0

History Node

0.1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
django-jsonschema-0.2.0.macosx-10.9-intel.exe (69.7 kB) Copy SHA256 hash SHA256 Windows Installer any Apr 5, 2014
django-jsonschema-0.2.0.tar.gz (5.0 kB) Copy SHA256 hash SHA256 Source None Apr 5, 2014

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page