{ "info": { "author": "Marc Zimmermann", "author_email": "tooreht@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Framework :: Django", "Framework :: Django :: 1.10", "Framework :: Django :: 1.11", "Framework :: Django :: 1.8", "Framework :: Django :: 1.9", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Natural Language :: English", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6" ], "description": "django-jsonsuit\n===============\n\n|image| |image| |image|\n\nDjango goodies to dress JSON data in a suit.\n\nDocumentation\n-------------\n\nThe full documentation is at https://tooreht.github.io/django-jsonsuit.\n\nFeatures\n--------\n\n- Editable and readonly widget\n- Change JSON syntax highlighter themes\n- Set custom widget media (JS & CSS) files\n- Use custom HTML templates\n\nQuickstart\n----------\n\nInstall django-jsonsuit:\n\n::\n\n pip install django-jsonsuit\n\nAdd it to your ``INSTALLED_APPS``:\n\n.. code:: sourcecode\n\n INSTALLED_APPS = (\n ...\n 'jsonsuit.apps.JSONSuitConfig',\n ...\n )\n\nUsage\n-----\n\nWidgets\n~~~~~~~\n\ndjango-jsonsuit currently provides two widgets to dress your JSON data:\n\n1. ``JSONSuit``: Widget that displays JSON data with indentation and\n syntax highlighting as default, but allows to toggle between the\n standard django ``Textarea`` for editing.\n2. ``ReadonlyJSONSuit``: Widget that simply displays JSON data with\n indentation and syntax highlighting. It is useful for JSON fields\n that contain readonly data.\n\n**Note**: Because a widget in django is only responsible for displaying\nfields, it has no direct access to its field properties. Thus there is\nno easy way to check if the field is readonly. The readonly behaviour is\neven handled differently among django forms, model forms and admin. This\nis why the ``ReadonlyJSONSuit`` was introduced.\n\nJSONSuit\n^^^^^^^^\n\nIn a form or model admin, enable a JSON suit for a particular field:\n\n.. code:: python\n\n from jsonsuit.widgets import JSONSuit\n\n class JSONForm(forms.ModelForm):\n class Meta:\n model = Test\n fields = '__all__'\n widgets = {\n 'myjsonfield': JSONSuit(),\n }\n\n class JSONAdmin(admin.ModelAdmin):\n form = JSONForm\n\nEnable JSON suit for every JSONField of a model:\n\n.. code:: python\n\n from django.contrib.postgres.fields import JSONField\n\n class JSONAdmin(admin.ModelAdmin):\n formfield_overrides = {\n JSONField: {'widget': JSONSuit }\n }\n\nReadonlyJSONSuit\n^^^^^^^^^^^^^^^^\n\nIn a form or model admin, enable a readonly JSON suit for a particular\nfield:\n\n.. code:: python\n\n from jsonsuit.widgets import ReadonlyJSONSuit\n\n class ReadonlyJSONForm(forms.ModelForm):\n class Meta:\n model = Test\n fields = '__all__'\n widgets = {\n 'myjsonfield': ReadonlyJSONSuit(),\n }\n\n class ReadonlyJSONAdmin(admin.ModelAdmin):\n form = ReadonlyJSONForm\n\nEnable readonly JSON suit for every JSONField of a model:\n\n.. code:: python\n\n from django.contrib.postgres.fields import JSONField\n\n class ReadonlyJSONAdmin(admin.ModelAdmin):\n formfield_overrides = {\n JSONField: {'widget': ReadonlyJSONSuit }\n }\n\nTemplate Tags\n~~~~~~~~~~~~~\n\nUse the jsonsuit template tag to display serializable objects in\ntemplates. Note that in order to use the ``jsonsuit``, ``jsonsuit_css``\nand ``jsonsuit_js`` tags, they must be loaded using\n``{% load jsonsuit %}``.\n\n.. code:: html\n\n {% extends \"ui/base.html\" %}\n {% load jsonsuit %}\n\n {% block title %}{% trans \"JSONSuit Template Tag\" %}{% endblock %}\n\n {% block styles %}\n {{ block.super }}\n {% jsonsuit_css %} \n {% endblock %}\n\n {% block content %}\n