mirror of
https://github.com/django/django.git
synced 2025-07-24 13:44:32 +00:00
[3.1.x] Fixed #31836 -- Dropped support for JSONField __contains and __contained_by lookups on SQLite.
The current implementation works only for basic examples without
supporting nested structures and doesn't follow "the general principle
that the contained object must match the containing object as to
structure and data contents, possibly after discarding some
non-matching array elements or object key/value pairs from the
containing object".
Backport of ba691933ce
from master.
This commit is contained in:
parent
028a5f86f2
commit
247bcef6b4
8 changed files with 57 additions and 54 deletions
|
@ -533,7 +533,10 @@ backends.
|
|||
``DatabaseFeatures.supports_json_field`` to ``False``. If storing primitives
|
||||
is not supported, set ``DatabaseFeatures.supports_primitives_in_json_field``
|
||||
to ``False``. If there is a true datatype for JSON, set
|
||||
``DatabaseFeatures.has_native_json_field`` to ``True``.
|
||||
``DatabaseFeatures.has_native_json_field`` to ``True``. If
|
||||
:lookup:`jsonfield.contains` and :lookup:`jsonfield.contained_by` are not
|
||||
supported, set ``DatabaseFeatures.supports_json_field_contains`` to
|
||||
``False``.
|
||||
|
||||
* Third party database backends must implement introspection for ``JSONField``
|
||||
or set ``can_introspect_json_field`` to ``False``.
|
||||
|
|
|
@ -960,9 +960,9 @@ contained in the top-level of the field. For example::
|
|||
>>> Dog.objects.filter(data__contains={'breed': 'collie'})
|
||||
<QuerySet [<Dog: Meg>]>
|
||||
|
||||
.. admonition:: Oracle
|
||||
.. admonition:: Oracle and SQLite
|
||||
|
||||
``contains`` is not supported on Oracle.
|
||||
``contains`` is not supported on Oracle and SQLite.
|
||||
|
||||
.. fieldlookup:: jsonfield.contained_by
|
||||
|
||||
|
@ -984,9 +984,9 @@ subset of those in the value passed. For example::
|
|||
>>> Dog.objects.filter(data__contained_by={'breed': 'collie'})
|
||||
<QuerySet [<Dog: Fred>]>
|
||||
|
||||
.. admonition:: Oracle
|
||||
.. admonition:: Oracle and SQLite
|
||||
|
||||
``contained_by`` is not supported on Oracle.
|
||||
``contained_by`` is not supported on Oracle and SQLite.
|
||||
|
||||
.. fieldlookup:: jsonfield.has_key
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue