{"id":13619228,"url":"https://github.com/laymonage/django-jsonfield-backport","last_synced_at":"2025-04-14T09:40:45.971Z","repository":{"id":43665907,"uuid":"276360966","full_name":"laymonage/django-jsonfield-backport","owner":"laymonage","description":"Backport of the cross-DB JSONField model and form fields from Django 3.1.","archived":false,"fork":false,"pushed_at":"2022-02-25T01:52:38.000Z","size":185,"stargazers_count":43,"open_issues_count":3,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-29T23:32:18.855Z","etag":null,"topics":["backport","django","fields","forms","hacktoberfest","jsonfield","models"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/django-jsonfield-backport","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/laymonage.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"patreon":"sage","custom":["https://paypal.me/laymonage"]}},"created_at":"2020-07-01T11:35:44.000Z","updated_at":"2025-03-21T12:53:02.000Z","dependencies_parsed_at":"2022-08-22T16:10:55.827Z","dependency_job_id":null,"html_url":"https://github.com/laymonage/django-jsonfield-backport","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laymonage%2Fdjango-jsonfield-backport","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laymonage%2Fdjango-jsonfield-backport/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laymonage%2Fdjango-jsonfield-backport/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laymonage%2Fdjango-jsonfield-backport/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/laymonage","download_url":"https://codeload.github.com/laymonage/django-jsonfield-backport/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248855599,"owners_count":21172603,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backport","django","fields","forms","hacktoberfest","jsonfield","models"],"created_at":"2024-08-01T21:00:36.416Z","updated_at":"2025-04-14T09:40:45.942Z","avatar_url":"https://github.com/laymonage.png","language":"Python","funding_links":["https://patreon.com/sage","https://paypal.me/laymonage"],"categories":["D"],"sub_categories":[],"readme":"=========================\ndjango-jsonfield-backport\n=========================\n\n.. image:: https://img.shields.io/pypi/v/django-jsonfield-backport.svg\n   :target: https://pypi.org/project/django-jsonfield-backport/\n\n.. image:: https://img.shields.io/pypi/l/django-jsonfield-backport\n   :target: https://github.com/laymonage/django-jsonfield-backport/blob/master/LICENSE\n\n.. image:: https://github.com/laymonage/django-jsonfield-backport/workflows/Test/badge.svg\n   :target: https://github.com/laymonage/django-jsonfield-backport/actions?workflow=Test\n\n.. image:: https://coveralls.io/repos/laymonage/django-jsonfield-backport/badge.svg\n   :target: https://coveralls.io/r/laymonage/django-jsonfield-backport\n\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg\n   :target: https://github.com/python/black\n\n|\n\nBackport of the cross-DB `JSONField`__ model and form fields from Django 3.1.\n\n.. __: https://docs.djangoproject.com/en/dev/releases/3.1/#jsonfield-for-all-supported-database-backends\n\n.. code-block:: python\n\n    from django.db import models\n    from django_jsonfield_backport.models import JSONField\n\n    class ContactInfo(models.Model):\n        data = JSONField()\n\n    ContactInfo.objects.create(data={\n        'name': 'John',\n        'cities': ['London', 'Cambridge'],\n        'pets': {'dogs': ['Rufus', 'Meg']},\n    })\n    ContactInfo.objects.filter(\n        data__name='John',\n        data__pets__has_key='dogs',\n        data__cities__contains='London',\n    ).delete()\n\nFeatures\n========\n\nMost features of the JSONField model and form fields from Django 3.1 are\nsupported.\n\n* MariaDB, MySQL, Oracle, PostgreSQL, and SQLite support.\n* JSONField lookups and transforms support.\n* Custom encoder and decoder support.\n\nDue to limited access to Django's APIs, some features are not supported.\n\n* Introspection is not supported.\n* On MariaDB and Oracle, ``Cast``\\ing to JSONField must be done using the\n  included ``JSONCast`` class.\n\nThis package is fully compatible with the JSONField from Django 3.1. That\nmeans you just need to change your imports and edit your migrations when you\nfinally upgrade to Django 3.1. If you leave them as they are, this package\nwill use the built-in JSONField and system warnings will be raised.\n\nRequirements\n============\n\nThis package supports and is tested against the latest patch versions of:\n\n* **Python:** 3.5 (Django 2.2 only), 3.6, 3.7, 3.8, 3.9\n* **Django:** 2.2, 3.0, 3.1\n* **MariaDB:** 10.2, 10.3, 10.4, 10.5\n* **MySQL:** 5.7, 8.0\n* **Oracle:** 12.2+ (only tested against 12.2.0.1 SE)\n* **PostgreSQL:** 9.5, 10, 11, 12\n* **SQLite:** 3.9.0+ with the `JSON1`_ extension\n\nAll database backends are tested with the latest versions of their drivers.\nSQLite is also tested on GitHub Actions' latest macOS and Windows virtual\nenvironments.\n\n.. _JSON1: https://docs.djangoproject.com/en/3.1/ref/databases/#sqlite-json1\n\nInstallation\n============\n\n1. Use **pip** or your preferred dependency management tool to install the package.\n\n   .. code-block:: shell\n\n       $ pip install django-jsonfield-backport\n\n2. Add ``\"django_jsonfield_backport\"`` to ``INSTALLED_APPS`` in your settings.\n\n   .. code-block:: python\n\n       INSTALLED_APPS = [\n           ...\n           \"django_jsonfield_backport\",\n       ]\n\nUsage\n=====\n\nTo use the model and form fields, import ``JSONField`` from\n``django_jsonfield_backport.models`` and ``django_jsonfield_backport.forms``,\nrespectively.\n\nModel field example:\n\n.. code-block:: python\n\n    from django.db import models\n    from django_jsonfield_backport.models import JSONField\n\n    class ContactInfo(models.Model):\n        data = JSONField()\n\nForm field example:\n\n.. code-block:: python\n\n    from django import forms\n    from django_jsonfield_backport.forms import JSONField\n\n    class ContactForm(forms.Form):\n        data = JSONField()\n\n``JSONCast``, ``KeyTransform``, and ``KeyTextTransform`` classes are also\navailable from ``django_jsonfield_backport.models``.\n\nDocumentation\n=============\n\nSince this package is a backport, the official Django 3.1 docs for\n|models.JSONField|_ and |forms.JSONField|_ are mostly compatible with this\npackage.\n\n.. |models.JSONField| replace:: ``models.JSONField``\n.. |forms.JSONField| replace:: ``forms.JSONField``\n\n.. _models.JSONField: https://docs.djangoproject.com/en/3.1/ref/models/fields/#django.db.models.JSONField\n.. _forms.JSONField: https://docs.djangoproject.com/en/3.1/ref/forms/fields/#django.forms.JSONField\n\nRationale\n=========\n\nAs of the creation of this package, JSONField implementations exist in multiple\npackages on PyPI:\n\n* `Django \u003chttps://github.com/django/django\u003e`_:\n  Before Django 3.1, PostgreSQL-only JSONField exists in the ``contrib.postgres``\n  module.\n\n* `jsonfield \u003chttps://github.com/rpkilby/jsonfield\u003e`_:\n  1.1k stars, cross-DB support with no extended querying capabilities.\n\n* `django-annoying \u003chttps://github.com/skorokithakis/django-annoying#jsonfield\u003e`_:\n  787 stars, has a ``TextField``-based JSONField with no extended querying\n  capabilities.\n\n* `Django-MySQL \u003chttps://github.com/adamchainz/django-mysql\u003e`_:\n  364 stars, has a MariaDB/MySQL-only JSONField with extended querying\n  capabilities (not entirely the same as in ``contrib.postgres``).\n\n* `django-jsonfallback \u003chttps://github.com/raphaelm/django-jsonfallback\u003e`_:\n  26 stars, uses JSONField from ``contrib.postgres`` and Django-MySQL before\n  falling back to ``TextField``\\-based JSONField.\n\n* `django-json-field \u003chttps://github.com/derek-schaefer/django-json-field\u003e`_:\n  116 stars, ``TextField``-based JSONField with custom encoder and decoder\n  support with no extended querying capabilities (unmaintained).\n\n* `django-jsonfield \u003chttps://github.com/adamchainz/django-jsonfield\u003e`_:\n  21 stars, cross-DB support with no extended querying capabilities.\n\n* `django-jsonfield-compat \u003chttps://github.com/kbussell/django-jsonfield-compat\u003e`_:\n  8 stars, compatibility layer for ``contrib.postgres`` JSONField and\n  django-jsonfield.\n\n* `oracle-json-field \u003chttps://github.com/Exscientia/oracle-json-field\u003e`_:\n  2 stars, Oracle-only JSONField with extended querying capabilities\n  (not entirely the same as in ``contrib.postgres``).\n\nAlong with other unmaintained packages such as `dj-jsonfield`_,\n`vlk-django-jsonfield`_, `linaro-django-jsonfield`_, `jsonfield2`_,\n`django-jsonfield2`_, `django-softmachine`_, `django-simple-jsonfield`_,\n`easy_jsonfield`_, and `django-jsonbfield`_.\n\n.. _dj-jsonfield: https://github.com/ratson/dj-jsonfield\n.. _vlk-django-jsonfield: https://github.com/vialink/vlk-django-jsonfield\n.. _linaro-django-jsonfield: https://pypi.org/project/linaro-django-jsonfield\n.. _jsonfield2: https://github.com/rpkilby/jsonfield2\n.. _django-jsonfield2: https://github.com/DarioGT/django-jsonfield2\n.. _django-softmachine: https://github.com/certae/django-softmachine\n.. _django-simple-jsonfield: https://github.com/devkral/django-simple-jsonfield\n.. _easy_jsonfield: https://github.com/claydodo/easy_jsonfield\n.. _django-jsonbfield: https://pypi.org/project/django-jsonbfield\n\nWhy create another one?\n-----------------------\n\nUp until the new JSONField in Django 3.1, there had been no implementation of\nJSONField that supports all the database backends supported by Django with more\nor less **the same functionalities** as the ``contrib.postgres`` JSONField\nprovides.\n\n`Django's release process`_ does not backport new features to previous feature\nreleases. However, the current LTS release is 2.2 which is still supported until\nApril 2022. The next LTS release is Django 3.2 in April 2021 that happens to be\nthe end of extended support for Django 3.1.\n\nSome projects only use LTS releases of Django. There are also incompatibilities\nbetween Django 3.0 and 3.1. Therefore, using Django 3.1 may not be an option for\nsome people at the moment.\n\nSince JSONField seems to be in popular demand and that it works well as a\nstandalone package, I decided to create a backport.\n\nBesides, I'm the `co-author of the new JSONField`_. ¯\\\\_(ツ)_/¯\n\n.. _Django's release process: https://docs.djangoproject.com/en/dev/internals/release-process/#supported-versions\n.. _co-author of the new JSONField: https://github.com/django/django/pull/12392\n\nLicense\n=======\n\nThis package is licensed under the `BSD 3-Clause License`_.\n\n.. _BSD 3-Clause License: https://github.com/laymonage/django-jsonfield-backport/blob/master/LICENSE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaymonage%2Fdjango-jsonfield-backport","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flaymonage%2Fdjango-jsonfield-backport","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaymonage%2Fdjango-jsonfield-backport/lists"}