django-jsonfield-1.4.0/0000755000076500000240000000000013576524311015337 5ustar chainzstaff00000000000000django-jsonfield-1.4.0/LICENSE0000644000076500000240000000266313443156710016350 0ustar chainzstaff00000000000000Copyright (c) 2012, Matthew Schinckel. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * The names of its contributors may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHEW SCHINCKEL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. django-jsonfield-1.4.0/MANIFEST.in0000644000076500000240000000022013443156710017064 0ustar chainzstaff00000000000000recursive-include jsonfield *.py include jsonfield/VERSION include README.rst include tests.py include LICENSE recursive-exclude jsonfield *.pycdjango-jsonfield-1.4.0/PKG-INFO0000644000076500000240000002762313576524311016446 0ustar chainzstaff00000000000000Metadata-Version: 1.2 Name: django-jsonfield Version: 1.4.0 Summary: JSONField for django models Home-page: https://github.com/adamchainz/django-jsonfield Author: Matthew Schinckel Author-email: matt@schinckel.net Maintainer: Adam Johnson Maintainer-email: me@adamj.eu License: UNKNOWN Description: django-jsonfield ================ **Maintenance mode only:** It is not recommended you use this library on new projects. See the (long) **History** section below for why and alternatives. ---- Cross-database JSON field for Django models. History ------- This project was created in 2010 by Matthew Schinckel. He created it based upon code from `David Cramer's blog `_, had the repository in Mercurial on `BitBucket `_, and maintained it until 2018. In March 2019, Adam Johnson took over maintenance (from an invite back in 2018!), and moved it to Git on `GitHub `_ because he's no good at Mercurial and "everyone" uses GitHub these days. At the time it was created, the databases that Django supports didn't feature native JSON support. Since then, most of them have gained that ability. Correspondingly, there are some Django field implementations for taking advantage of this: * A PostgreSQL ``JSONField`` is provided in `django.contrib.postgres `_, which was created as part of Django in version 1.9, released December 2015. Note this library interferes with the way that works, see `issue 5 `_ for explanation and a workaround. * A MySQL (and maybe MariaDB) ``JSONField`` is provided in `Django-MySQL `_, since version 1.0.7, released March 2016. At time of writing this history (March 2019), there still isn't a JSONField implementation that can take advantage of the native features on all the databases. This has been discussed on the ``django-developers`` mailing list several times though. The ``JSONField`` provided by this library uses native features on PostgreSQL, but not on any other database, so it's in a bit of a weird place. If you are considering adding this to a new project, you probably don't want it, instead: * If you want native JSON support from your database and you're using PostgreSQL or MySQL, use the native fields as per the links above. * If you don't want native JSON support, consider just storing the JSON in a ``TextField`` and deserializing it appropriately in your code, perhaps with a simple model property to proxy it. * If you need native JSON support on a database for which there is no Django field implementation, try making it yourself or getting in touch to see if there's something that can be done. Installation ------------ Install it with **pip**: .. code-block:: sh pip install django-jsonfield Then use the field in your models: .. code-block:: python from django.db import models import jsonfield class MyModel(models.Model): the_json = jsonfield.JSONField() You can assign any JSON-encodable object to this field. It will be JSON-encoded before being stored in the database as a text value and it will be turned back into a python list/dict/string upon retrieval from the database. There is also a ``TypedJSONField``, that allows you to define data types that must be included within each object in the array. More documentation to follow. Notes ~~~~~ If no ``default`` is provided, and ``null=True`` is not passed in to the field constructor, then a default of ``{}`` will be used. Supported django versions ------------------------- All versions of Django from 1.8 onwards are tested. Extras ------ jsonify templatetag ~~~~~~~~~~~~~~~~~~~ This allows you to convert a python data structure into JSON within a template:: {% load jsonify %} Note that you must only use the "safe" filter when you use the jsonify filter within a Note that you must only use the "safe" filter when you use the jsonify filter within a Note that you must only use the "safe" filter when you use the jsonify filter within a