{ "info": { "author": "Carlos Salom", "author_email": "csalom@apsl.net", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Software Development" ], "description": "Wagtail JsonSchema Forms\n========================\n\n.. image:: https://api.travis-ci.org/APSL/wagtail-jsonschema-forms.svg?branch=master\n :target: https://travis-ci.org/APSL/wagtail-jsonschema-forms\n\nWagtail JsonSchema Forms is a simple Django app to Generate JsonSchema Forms from Wagtail's forms and validate it.\n\nThis app allows the generation of a JsonSchema form from a Wagtail's form in order to use JsonSchema technology.\nIn addition, it allows you to parse the response and validate it. After the validation, the wagtail form is\nsubmitted.\n\nFor example, you can retrieve the jsonschema from through an api, then validate the submitted data and finally\nsubmit de wagtail form.\n\nInstallation\n------------\n\nYou can install \"wagtail_jsonschema_forms\" via `pip`_ from `APSL GitHub`_:\n\n* pip install git+https://github.com/APSL/wagtail_jsonschema_forms.git#egg=wagtail_jsonschema_forms\n\nAnd then you have to add :code:`wagtail_jsonschema_forms` to your :code:`INSTALLED_APPS`.\n\n\nUtilities provided\n------------------\nThis app offers two python classes to generate the jsonschema and to submit the json response.\n\nJsonSchemaGenerator\n~~~~~~~~~~~~~~~~~~~\n\nThis first class has a method :code:`wagtail_form_to_json_schema` that goes over\nall the fields of the form and generate its jsonschema representation, if they are suported.\n\nEvery suported field type has a method that generate the representation, which is called during the generation.\nIf the field is required, it will be indicated too.\n\n\nJsonSchemaParser\n~~~~~~~~~~~~~~~~\n\nThis second class provides two main methods:\n\n* :code:`validate_json`:\n method that validates the json recieved under the schema a return a dict with the possible errors.\n If there are no error, a empty dict will be returned.\n* :code:`process_form_submission`:\n method that accepts form instance with submitted data and page and creates submission instance.\n Inside of this method, another one is called to format the data submited in order to create the\n submission instance.\n\n\nUsage\n-----\nAs was explained before, this django app generates jsonschema forms from Wagtail's form and validate it.\nWagtail's forms offers a very rich set of form field types. However, not all of them are suported on\nJsonSchema and has not been covered on this app. For that reason, when you declare your :code:`FormField`\nclass on your models.py you should override the field_type field and the :code:`FORM_FIELD_CHOICES` variable:\n\n.. code-block:: python\n\n FORM_FIELD_CHOICES = (\n ('singleline', _('Single line text')),\n ('multiline', _('Multi-line text')),\n ('email', _('Email')),\n ('number', _('Number')),\n ('url', _('URL')),\n ('checkbox', _('Checkbox')),\n ('dropdown', _('Drop down')),\n ('date', _('Date')),\n ('datetime', _('Date/time')),\n )\n\n field_type = models.CharField(verbose_name=_('field type'), max_length=16, choices=FORM_FIELD_CHOICES)\n\nThere are two ways to use wagtail_json_schema_forms: you can choose between using the mixins or the abstract\nmodels provided.\n\nMixins\n~~~~~~\n\nIf you choose to use the mixins, the first thing thant you have to do is to add a new :code:`TextField` atribute\nto your wagtail form page called 'json_schema'. This field will be used to save the JsonSchema representation\nof the form.\n\nTwo mixins are provided: :code:`JsonSchemaFormMixin` and :code:`JsonSchemaEmailFormMixin`, which inherit from the first one.\n\n:code:`JsonSchemaFormMixin` overrides the save method in order to generate the json schema before every time the\nwagtail page is saved. This mixin uses the generator class explained above to prepare the jsonschema from the form.\n\nIt's also overrided the method :code:`process_form_submission`, where it's checked if the form has been submited as\na usual wagtail form or using jsonschema. If jsonschema has been used for submition, the parser class is used\nto register the form submission.\n\nAs said, the :code:`JsonSchemaEmailFormMixin` inherits from :code:`JsonSchemaFormMixin`. The diference between them is in\nthe process of the form submission. This second mixin tries to send an email after the form submission, if the\n:code:`to_address` attribute of the wagtail page has been filed.\n\n\nAbstract Models\n~~~~~~~~~~~~~~~\n\nAgain, there are two abstract models provided to allow to add the jsonschema functionality to a plain WagtailForm\nand a EmailWagtailForm: :code:`AbstractJsonSchemaForm` and :code:`AbstractJsonSchemaEmailForm`.\n\nThese abstract models inherit from the mixins explained above and the :code:`AbstractForm` or :code:`AbstractEmailForm`.\nThey also add the new :code:`TextField` atribute required. Then, Wagtail Pages implementing a form that need to\ngenerate a JsonSchema (and to send and email) should inherit from it.\n\n\n\nContributing\n------------\n\nContributions are very welcome. Please open a pull request or `file an issue`_.\nTests will be ready as soon as posible, please ensure the coverage at least stays the same\nbefore you submit a pull request.\n\nLicense\n-------\n\nDistributed under the terms of the `MIT`_ license, \"wagtail_jsonschema_forms\" is free and open source software\n\n\nIssues\n------\n\nIf you encounter any problems, please `file an issue`_ along with a detailed description.\n\n.. _`pip`: https://pypi.python.org/pypi/pip/\n.. _`APSL GitHub`: https://github.com/APSL/wagtail_jsonschema_forms\n.. _`file an issue`: https://github.com/APSL/wagtail_jsonschema_forms/issues\n.. _`MIT`: http://opensource.org/licenses/MIT", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/APSL/wagtail-jsonschema-forms", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "wagtail-jsonschema-forms", "package_url": "https://pypi.org/project/wagtail-jsonschema-forms/", "platform": "", "project_url": "https://pypi.org/project/wagtail-jsonschema-forms/", "project_urls": { "Homepage": "https://github.com/APSL/wagtail-jsonschema-forms" }, "release_url": "https://pypi.org/project/wagtail-jsonschema-forms/0.1/", "requires_dist": null, "requires_python": "", "summary": "Generate JsonSchema Forms from Wagtail's forms and validate it", "version": "0.1" }, "last_serial": 3267145, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "150b8b463ac1a562e0c796992650b672", "sha256": "b626926d7478a9fe130634880de13a05effb125329d16af58fdc892c249bbb7b" }, "downloads": -1, "filename": "wagtail-jsonschema-forms-0.1.tar.gz", "has_sig": false, "md5_digest": "150b8b463ac1a562e0c796992650b672", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13331, "upload_time": "2017-10-20T21:51:59", "url": "https://files.pythonhosted.org/packages/6e/38/d4c9221bfb0eee9bb8731680bede4ba457a0e9b737f9e62ca69bc20922d5/wagtail-jsonschema-forms-0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "150b8b463ac1a562e0c796992650b672", "sha256": "b626926d7478a9fe130634880de13a05effb125329d16af58fdc892c249bbb7b" }, "downloads": -1, "filename": "wagtail-jsonschema-forms-0.1.tar.gz", "has_sig": false, "md5_digest": "150b8b463ac1a562e0c796992650b672", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13331, "upload_time": "2017-10-20T21:51:59", "url": "https://files.pythonhosted.org/packages/6e/38/d4c9221bfb0eee9bb8731680bede4ba457a0e9b737f9e62ca69bc20922d5/wagtail-jsonschema-forms-0.1.tar.gz" } ] }