wtforms-jsonschema converts WTForms into JSON Schema compatibile representations
Project description
Introduction
wtforms-jsonschema converts WTForms into JSON Schema compatibile representations
Requirements
Python 2.6 or later
Wtforms
Usage
To convert a form to a JSON Schema:
from wtforms_jsonschema.jsonschema import WTFormToJSONSchema schema_repr = WTFormToJSONSchema().convert_form(MyForm)
TODO: To embed a JSON Schema as a form field:
from wtforms_jsonschema.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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file wtforms-jsonschema-0.0.7.tar.gz
.
File metadata
- Download URL: wtforms-jsonschema-0.0.7.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62e1191c66ce81907da55c33319b4c1fca496861e4406f61f653e4b26b8a30a9 |
|
MD5 | e633445927fc375a2168ae25b81c1d06 |
|
BLAKE2b-256 | 7f81b38800a48a919b63b8ed144f2c5f5aa30f666cc699d653a22cafa646dec1 |