diff options
Diffstat (limited to 'docs/ref')
| -rw-r--r-- | docs/ref/checks.txt | 4 | ||||
| -rw-r--r-- | docs/ref/contrib/postgres/fields.txt | 53 |
2 files changed, 3 insertions, 54 deletions
diff --git a/docs/ref/checks.txt b/docs/ref/checks.txt index e79a50b831..aae23d1d20 100644 --- a/docs/ref/checks.txt +++ b/docs/ref/checks.txt @@ -212,7 +212,9 @@ Model fields historical migrations. * **fields.W904**: ``django.contrib.postgres.fields.JSONField`` is deprecated. Support for it (except in historical migrations) will be removed in Django - 4.0. + 4.0. *This check appeared in Django 3.1 and 3.2*. +* **fields.E904**: ``django.contrib.postgres.fields.JSONField`` is removed + except for support in historical migrations. File fields ~~~~~~~~~~~ diff --git a/docs/ref/contrib/postgres/fields.txt b/docs/ref/contrib/postgres/fields.txt index eee99592b3..7754ff3d65 100644 --- a/docs/ref/contrib/postgres/fields.txt +++ b/docs/ref/contrib/postgres/fields.txt @@ -482,59 +482,6 @@ using in conjunction with lookups on >>> Dog.objects.filter(data__values__contains=['collie']) <QuerySet [<Dog: Meg>]> -``JSONField`` -============= - -.. class:: JSONField(encoder=None, **options) - - A field for storing JSON encoded data. In Python the data is represented in - its Python native format: dictionaries, lists, strings, numbers, booleans - and ``None``. - - .. attribute:: encoder - - An optional JSON-encoding class to serialize data types not supported - by the standard JSON serializer (``datetime``, ``uuid``, etc.). For - example, you can use the - :class:`~django.core.serializers.json.DjangoJSONEncoder` class or any - other :py:class:`json.JSONEncoder` subclass. - - When the value is retrieved from the database, it will be in the format - chosen by the custom encoder (most often a string), so you'll need to - take extra steps to convert the value back to the initial data type - (:meth:`Model.from_db() <django.db.models.Model.from_db>` and - :meth:`Field.from_db_value() <django.db.models.Field.from_db_value>` - are two possible hooks for that purpose). Your deserialization may need - to account for the fact that you can't be certain of the input type. - For example, you run the risk of returning a ``datetime`` that was - actually a string that just happened to be in the same format chosen - for ``datetime``\s. - - If you give the field a :attr:`~django.db.models.Field.default`, ensure - it's a callable such as ``dict`` (for an empty default) or a callable that - returns a dict (such as a function). Incorrectly using ``default={}`` - creates a mutable default that is shared between all instances of - ``JSONField``. - -.. note:: - - PostgreSQL has two native JSON based data types: ``json`` and ``jsonb``. - The main difference between them is how they are stored and how they can be - queried. PostgreSQL's ``json`` field is stored as the original string - representation of the JSON and must be decoded on the fly when queried - based on keys. The ``jsonb`` field is stored based on the actual structure - of the JSON which allows indexing. The trade-off is a small additional cost - on writing to the ``jsonb`` field. ``JSONField`` uses ``jsonb``. - -.. deprecated:: 3.1 - - Use :class:`django.db.models.JSONField` instead. - -Querying ``JSONField`` ----------------------- - -See :ref:`querying-jsonfield` for details. - .. _range-fields: Range Fields |
