{ "info": { "author": "Alexander Abbasov, django-split-json-widget", "author_email": "abbasovalex@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Topic :: Internet :: WWW/HTTP" ], "description": "django-split-json-widget\n===\n\n[![Build Status](https://travis-ci.org/abbasovalex/django-SplitJSONWidget-form.svg?branch=master)](https://travis-ci.org/abbasovalex/django-SplitJSONWidget-form)\n\nA widget that renders JSON data as separate editable inputs.\n\n## Installation\n\n```pip install django-split-json-widget```\nor\n```pip install git+https://github.com/abbasovalex/django-SplitJSONWidget-form.git```\n\n### Example \u21161\n\n#### forms.py\n\n```python\n# -*- coding: utf-8 -*-\nfrom django import forms\nfrom splitjson.widgets import SplitJSONWidget\n\n\nclass testForm(forms.Form):\n attrs = {'class': 'special', 'size': '40'}\n data = forms.CharField(widget=SplitJSONWidget(attrs=attrs, debug=True))\n```\n\n#### views.py\n```python\n# -*- coding: utf-8 -*-\nfrom django.shortcuts import render_to_response\nfrom django.template import RequestContext\nfrom forms import testForm\n\ndef test_dict(request):\n json = {'a': 1,\n 'b': 2,\n 'c': 3,\n 'd': 4}\n form = testForm(request.POST or None, initial={'data': json})\n if form.is_valid():\n # validate and save\n pass\n\n template = 'test_template.html'\n context = RequestContext(request, {'form': form})\n return render_to_response(template, context)\n```\n\n#### test_template.py\n```html\n\n\n \n\t\n\t\tErrors: \n {% for field, error in form.errors.items %}\n \n {% empty %}\n no errors \n {% endfor %}\n
\n List of:\n\t\t\t
\n\t\t\t\t{% csrf_token %}\n\t\t\t\t{{ form.as_p}}\n\t\t\t\t\n\t\t\t
\n\t\n\n```\n\n#### Result (with debug mode enabled)\n\n![simple dict](https://github.com/abbasovalex/django-SplitJSONWidget-form/blob/master/doc/sreenshots/test_dict.png?raw=true)\n\n\n### Example \u21162\n\n#### forms.py\n```python\n# -*- coding: utf-8 -*-\nfrom django import forms\nfrom splitjson.widgets import SplitJSONWidget\n\n\nclass testForm(forms.Form):\n attrs = {'class': 'special', 'size': '40'}\n data = forms.CharField(widget=SplitJSONWidget(attrs=attrs, debug=True))\n```\n\n#### views.py\n```python\n# -*- coding: utf-8 -*-\nfrom django.shortcuts import render_to_response\nfrom django.template import RequestContext\nfrom forms import testForm\n\ndef test_nested_dict(request):\n json = {'a': {'aa': 1},\n 'b': [2, 2, {'q': 'qq',\n 'w': 'ww',\n 'z': [1, 2, 3, 4, {'five': 'number',\n 'six': 'number'}, 7]}],\n 'c': 3,\n 'd': {'e':'ee', 'f':'ff'},\n 'listA': [99, 98, 97, {'text': 'string'}],\n 'ListA': [{'name': 'A', 'value': 'No'},\n {'name': 'B', 'value': 'No'},\n {'name': 'C', 'value': 'Yes'}]}\n form = testForm(request.POST or None, initial={'data': json})\n if form.is_valid():\n # validate and save\n pass\n\n template = 'test_template.html'\n context = RequestContext(request, {'form': form})\n return render_to_response(template, context)\n```\n\n#### test_template.py\n```html\n\n\n\t\n\t\n\t\tErrors: \n {% for field, error in form.errors.items %}\n \n {% empty %}\n no errors \n {% endfor %}\n
\n List of:\n\t\t\t
\n\t\t\t\t{% csrf_token %}\n\t\t\t\t{{ form.as_p}}\n\t\t\t\t\n\t\t\t
\n\t\n\n```\n\n#### Result (debug mode is enabled)\n\n![test](https://github.com/abbasovalex/django-SplitJSONWidget-form/blob/master/doc/sreenshots/test_nested_dict.png?raw=true)\n\n\n\n### Example \u21163\n\n#### forms.py\n```python\n# -*- coding: utf-8 -*-\nfrom django import forms\nfrom splitjson.widgets import SplitJSONWidget\n\n\nclass testForm(forms.Form):\n attrs = {'class': 'special', 'size': '40'}\n data = forms.CharField(widget=SplitJSONWidget(attrs=attrs, debug=True))\n```\n\n#### views.py\n```python\n# -*- coding: utf-8 -*-\nfrom django.shortcuts import render_to_response\nfrom django.template import RequestContext\nfrom forms import testForm\n\ndef test_list(request):\n json = ['a', 'b', 'c']\n form = testForm(request.POST or None, initial={'data': json})\n if form.is_valid():\n # validate and save\n pass\n\n template = 'test_template.html'\n context = RequestContext(request, {'form': form})\n return render_to_response(template, context)\n```\n\n#### test_template.py\n```html\n\n\n\t\n\t\n\t\tErrors: \n {% for field, error in form.errors.items %}\n \n {% empty %}\n no errors \n {% endfor %}\n
\n List of:\n\t\t\t
\n\t\t\t\t{% csrf_token %}\n\t\t\t\t{{ form.as_p}}\n\t\t\t\t\n\t\t\t
\n\t\n\n```\n\n#### Result (debug mode is enabled)\n\n![simple list](https://github.com/abbasovalex/django-SplitJSONWidget-form/blob/master/doc/sreenshots/test_list_.png?raw=true)\n\n\n### Example \u21164\n\n#### forms.py\n```python\n# -*- coding: utf-8 -*-\nfrom django import forms\nfrom splitjson.widgets import SplitJSONWidget\n\n\nclass testForm(forms.Form):\n attrs = {'class': 'special', 'size': '40'}\n data = forms.CharField(widget=SplitJSONWidget(attrs=attrs, debug=True))\n```\n\n#### views.py\n```python\n# -*- coding: utf-8 -*-\nfrom django.shortcuts import render_to_response\nfrom django.template import RequestContext\nfrom forms import testForm\n\ndef test_nested_list(request):\n json = [['a', 'b', [1, 2, 3]], {'c': 'best'}, 'd']\n form = testForm(request.POST or None, initial={'data': json})\n if form.is_valid():\n # validate and save\n pass\n\n template = 'test_template.html'\n context = RequestContext(request, {'form': form})\n return render_to_response(template, context)\n```\n\n#### test_template.py\n```html\n\n\n\t\n\t\n\t\tErrors: \n {% for field, error in form.errors.items %}\n \n {% empty %}\n no errors \n {% endfor %}\n
\n List of:\n\t\t\t
\n\t\t\t\t{% csrf_token %}\n\t\t\t\t{{ form.as_p}}\n\t\t\t\t\n\t\t\t
\n\t\n\n```\n\n#### Result (debug mode is enabled)\n\n![nested list](https://github.com/abbasovalex/django-SplitJSONWidget-form/blob/master/doc/sreenshots/test_nested_list%20.png?raw=true)\n\n## Known issues\nSee https://github.com/abbasovalex/django-SplitJSONWidget-form/issues?labels=bug&page=1&state=open\n\n\n[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/abbasovalex/django-splitjsonwidget-form/trend.png)](https://bitdeli.com/free \"Bitdeli Badge\")", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/abbasovalex/django-SplitJSONWidget-form", "keywords": "json django widget", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "django-split-json-widget", "package_url": "https://pypi.org/project/django-split-json-widget/", "platform": "any", "project_url": "https://pypi.org/project/django-split-json-widget/", "project_urls": { "Homepage": "https://github.com/abbasovalex/django-SplitJSONWidget-form" }, "release_url": "https://pypi.org/project/django-split-json-widget/1.16/", "requires_dist": null, "requires_python": "", "summary": "Provides a widget that renders JSON data as separate, editable inputs.", "version": "1.16" }, "last_serial": 3240521, "releases": { "1.15": [ { "comment_text": "", "digests": { "md5": "3e9fac8e3aed1b19f507f6738403a205", "sha256": "1e1a936701caf8f25def49ccba7e96a6230b6ee734624a5605dd977b9810f916" }, "downloads": -1, "filename": "django-split-json-widget-1.15.tar.gz", "has_sig": false, "md5_digest": "3e9fac8e3aed1b19f507f6738403a205", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5903, "upload_time": "2015-08-27T16:50:38", "url": "https://files.pythonhosted.org/packages/d7/00/1baf54dd9a23520e261ae39377b602ac81eb6127c10a168a7fc16d9b59a6/django-split-json-widget-1.15.tar.gz" } ], "1.16": [ { "comment_text": "", "digests": { "md5": "2a8c96cc579fdcbbd22e99a686e7648f", "sha256": "e6f9f7b0fdddcb8ba5ba457ca45ffd64b3381a9fa6cd98c46c9a543f3ee9cc9b" }, "downloads": -1, "filename": "django-split-json-widget-1.16.tar.gz", "has_sig": false, "md5_digest": "2a8c96cc579fdcbbd22e99a686e7648f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5912, "upload_time": "2017-10-10T20:54:30", "url": "https://files.pythonhosted.org/packages/1a/43/a624427c6a90daf634919e6acb65bbcb8b3f98f87eeed87d1ee3bf9be268/django-split-json-widget-1.16.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2a8c96cc579fdcbbd22e99a686e7648f", "sha256": "e6f9f7b0fdddcb8ba5ba457ca45ffd64b3381a9fa6cd98c46c9a543f3ee9cc9b" }, "downloads": -1, "filename": "django-split-json-widget-1.16.tar.gz", "has_sig": false, "md5_digest": "2a8c96cc579fdcbbd22e99a686e7648f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5912, "upload_time": "2017-10-10T20:54:30", "url": "https://files.pythonhosted.org/packages/1a/43/a624427c6a90daf634919e6acb65bbcb8b3f98f87eeed87d1ee3bf9be268/django-split-json-widget-1.16.tar.gz" } ] }