{ "info": { "author": "S. Andrew Sheppard", "author_email": "andrew@wq.io", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", "Framework :: Django", "Framework :: Django :: 1.11", "Framework :: Django :: 1.8", "Framework :: Django :: 2.0", "Framework :: Django :: 2.1", "License :: OSI Approved :: MIT License", "Natural Language :: English", "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", "Programming Language :: Python :: 3.7", "Topic :: Text Processing :: Markup :: HTML" ], "description": "# html-json-forms\n\nAn implementation of the [HTML JSON Form] specification for use with the [Django REST Framework]. Extracted from [wq.db] for general use.\n\nHTML JSON Forms use an array-style naming convention that makes it possible to represent complex nested JSON objects with regular HTML fields. The idea is that client applications (such as [wq.app]) and eventually browsers could parse these fields and submit structured JSON to the server. For backwards compatibility with older clients, the spec recommends implementing a fallback parser on the server to ensure that older clients can submit forms using the traditional method. This Python package is an implementation of that algorithm.\n\n```html\n\n
\n \n \n
\n```\n\n```js\n// Output\n{\n \"items\": [\n {\n \"name\": \"Example\",\n \"count\": \"5\"\n }\n ]\n}\n```\n\nNote that the HTML JSON Form spec was never finalized. The implementation is still useful as a formal way of representing structured data via traditional HTML forms.\n\n[![Latest PyPI Release](https://img.shields.io/pypi/v/html-json-forms.svg)](https://pypi.org/project/html-json-forms)\n[![Release Notes](https://img.shields.io/github/release/wq/html-json-forms.svg)](https://github.com/wq/html-json-forms/releases)\n[![License](https://img.shields.io/pypi/l/html-json-forms.svg)](https://github.com/wq/html-json-forms/blob/master/LICENSE)\n[![GitHub Stars](https://img.shields.io/github/stars/wq/html-json-forms.svg)](https://github.com/wq/html-json-forms/stargazers)\n[![GitHub Forks](https://img.shields.io/github/forks/wq/html-json-forms.svg)](https://github.com/wq/html-json-forms/network)\n[![GitHub Issues](https://img.shields.io/github/issues/wq/html-json-forms.svg)](https://github.com/wq/html-json-forms/issues)\n\n[![Travis Build Status](https://img.shields.io/travis/wq/html-json-forms/master.svg)](https://travis-ci.org/wq/html-json-forms)\n[![Python Support](https://img.shields.io/pypi/pyversions/html-json-forms.svg)](https://pypi.org/project/html-json-forms)\n[![Django Support](https://img.shields.io/pypi/djversions/html-json-forms.svg)](https://pypi.org/project/html-json-forms)\n\n## Usage\n\n`html-json-forms` is available via PyPI:\n\n```bash\npip3 install html-json-forms\n```\n\n### Functional\n\n```python\nfrom html_json_forms import parse_json_form\n\nparse_json_form({\n 'items[0][name]': \"Example\",\n 'items[0][count]': \"5\",\n})\n```\n\n### DRF Integration\nTo enable HTML JSON Form parsing in Django REST Framework, subclass `JSONFormSerializer`:\n\n```python\nfrom rest_framework import serializers\nfrom html_json_forms.serializers import JSONFormSerializer\nfrom .models import Parent, Child\n\nclass ChildSerializer(serializers.ModelSerializer):\n class Meta:\n model = Child\n\nclass ParentSerializer(JSONFormSerializer, serializers.ModelSerializer):\n children = ChildSerializer(many=True)\n class Meta:\n model = Parent\n\n# Alternatively you can use the pre-mixed JSONFormModelSerializer:\n# class ParentSerializer(JSONFormModelSerializer):\n# ...\n```\n\nNote that only the top-level serializer needs to have the `JSONFormSerializer` mixin; the nested serializers will \"just work\" as if the data had been submitted via JSON. Note further that this module only handles processing nested form data; it is still up to you to figure out how to handle [writing nested models][nested] (unless you are using [wq.db]'s [patterns] module, which includes writable nested serializers by default).\n\n[HTML JSON Form]: https://www.w3.org/TR/html-json-forms/\n[Django REST Framework]: http://www.django-rest-framework.org/\n[wq.db]: https://wq.io/wq.db\n[wq.app]: https://wq.io/wq.app\n[nested]: http://www.django-rest-framework.org/api-guide/serializers/#writable-nested-representations\n[patterns]: https://wq.io/docs/about-patterns\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/wq/html-json-forms", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "html-json-forms", "package_url": "https://pypi.org/project/html-json-forms/", "platform": "", "project_url": "https://pypi.org/project/html-json-forms/", "project_urls": { "Homepage": "https://github.com/wq/html-json-forms" }, "release_url": "https://pypi.org/project/html-json-forms/1.1.0/", "requires_dist": null, "requires_python": "", "summary": "Implementation of the HTML JSON Forms spec for use with the Django REST Framework.", "version": "1.1.0" }, "last_serial": 5153411, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "4048e27f956b40acc5f9d684ceec2053", "sha256": "b42f2223c8c4b69e72ede3faae05222952b45f70b9e5f2bf07209ca239dd787f" }, "downloads": -1, "filename": "html-json-forms-0.1.0.tar.gz", "has_sig": false, "md5_digest": "4048e27f956b40acc5f9d684ceec2053", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5898, "upload_time": "2016-03-04T22:53:52", "url": "https://files.pythonhosted.org/packages/51/71/08a887b64f002dc6ed11f6c613dd08417466911cdddf6bf0da1ba729b0e6/html-json-forms-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "42b0e29572327b880a942d4a89092b79", "sha256": "c62ec6198b9a9e87aae5cd31c3c00ab5140eebb1c6f26e1091c50fb5b84009d1" }, "downloads": -1, "filename": "html-json-forms-0.1.1.tar.gz", "has_sig": false, "md5_digest": "42b0e29572327b880a942d4a89092b79", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5972, "upload_time": "2016-03-07T21:31:02", "url": "https://files.pythonhosted.org/packages/05/62/31e70997f24ae8efa64fd8e1a24020e7d340ff63a15a592b35b91447ca37/html-json-forms-0.1.1.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "11015e091b53892410208c26caa63b49", "sha256": "231c174bb1e395c21d69fddc7bb922b9f686dc6a7dad8096d525e759192aee43" }, "downloads": -1, "filename": "html-json-forms-1.0.0.tar.gz", "has_sig": false, "md5_digest": "11015e091b53892410208c26caa63b49", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6075, "upload_time": "2016-08-23T15:00:56", "url": "https://files.pythonhosted.org/packages/94/8b/5cde26c27dc5e9dd1f3f62839f707f1e06f430e9a83ae6d3120de875af97/html-json-forms-1.0.0.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "1250569d5ef7b696f9b27ebea07961ac", "sha256": "f3c422edab78ae83f16a1ee2ab701956775a33b0b7c3a19e428db2bf2d086df2" }, "downloads": -1, "filename": "html_json_forms-1.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "1250569d5ef7b696f9b27ebea07961ac", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7146, "upload_time": "2019-04-17T05:46:38", "url": "https://files.pythonhosted.org/packages/09/cf/8b4b630c4793d9ddfa1e7a2b221b5ed87d7701531919478faac67da7ea57/html_json_forms-1.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "189afe3dc82bdb846bab76810e4cdde6", "sha256": "61af4b4c97ab2e9fc4149664585ac11a60e20aba5e2254e38cf4cdb69bc8f916" }, "downloads": -1, "filename": "html-json-forms-1.1.0.tar.gz", "has_sig": false, "md5_digest": "189afe3dc82bdb846bab76810e4cdde6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9728, "upload_time": "2019-04-17T05:46:40", "url": "https://files.pythonhosted.org/packages/8d/72/24d2166cd5cecf580ee07c36ccc6fc8ce6c1f1ada484c98097b780dcb4b9/html-json-forms-1.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1250569d5ef7b696f9b27ebea07961ac", "sha256": "f3c422edab78ae83f16a1ee2ab701956775a33b0b7c3a19e428db2bf2d086df2" }, "downloads": -1, "filename": "html_json_forms-1.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "1250569d5ef7b696f9b27ebea07961ac", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7146, "upload_time": "2019-04-17T05:46:38", "url": "https://files.pythonhosted.org/packages/09/cf/8b4b630c4793d9ddfa1e7a2b221b5ed87d7701531919478faac67da7ea57/html_json_forms-1.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "189afe3dc82bdb846bab76810e4cdde6", "sha256": "61af4b4c97ab2e9fc4149664585ac11a60e20aba5e2254e38cf4cdb69bc8f916" }, "downloads": -1, "filename": "html-json-forms-1.1.0.tar.gz", "has_sig": false, "md5_digest": "189afe3dc82bdb846bab76810e4cdde6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9728, "upload_time": "2019-04-17T05:46:40", "url": "https://files.pythonhosted.org/packages/8d/72/24d2166cd5cecf580ee07c36ccc6fc8ce6c1f1ada484c98097b780dcb4b9/html-json-forms-1.1.0.tar.gz" } ] }