[4.1.x] Fixed #33820 -- Doc'd "true"/"false"/"null" caveat for JSONField key transforms on SQLite.
Thanks Johnny Metz for the report. Regression in71ec102b01
. Backport ofe20e5d1557
from main
This commit is contained in:
parent
1fd79033f7
commit
265c3eb602
|
@ -712,6 +712,14 @@ You can also refer to fields on related models with reverse relations through
|
||||||
pronounced if you include multiple such fields in your ``values()`` query,
|
pronounced if you include multiple such fields in your ``values()`` query,
|
||||||
in which case all possible combinations will be returned.
|
in which case all possible combinations will be returned.
|
||||||
|
|
||||||
|
.. admonition:: Special values for ``JSONField`` on SQLite
|
||||||
|
|
||||||
|
Due to the way the ``JSON_EXTRACT`` and ``JSON_TYPE`` SQL functions are
|
||||||
|
implemented on SQLite, and lack of the ``BOOLEAN`` data type,
|
||||||
|
``values()`` will return ``True``, ``False``, and ``None`` instead of
|
||||||
|
``"true"``, ``"false"``, and ``"null"`` strings for
|
||||||
|
:class:`~django.db.models.JSONField` key transforms.
|
||||||
|
|
||||||
``values_list()``
|
``values_list()``
|
||||||
~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
@ -782,6 +790,14 @@ not having any author::
|
||||||
>>> Entry.objects.values_list('authors')
|
>>> Entry.objects.values_list('authors')
|
||||||
<QuerySet [('Noam Chomsky',), ('George Orwell',), (None,)]>
|
<QuerySet [('Noam Chomsky',), ('George Orwell',), (None,)]>
|
||||||
|
|
||||||
|
.. admonition:: Special values for ``JSONField`` on SQLite
|
||||||
|
|
||||||
|
Due to the way the ``JSON_EXTRACT`` and ``JSON_TYPE`` SQL functions are
|
||||||
|
implemented on SQLite, and lack of the ``BOOLEAN`` data type,
|
||||||
|
``values_list()`` will return ``True``, ``False``, and ``None`` instead of
|
||||||
|
``"true"``, ``"false"``, and ``"null"`` strings for
|
||||||
|
:class:`~django.db.models.JSONField` key transforms.
|
||||||
|
|
||||||
``dates()``
|
``dates()``
|
||||||
~~~~~~~~~~~
|
~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
|
@ -1091,6 +1091,12 @@ To query for missing keys, use the ``isnull`` lookup::
|
||||||
On PostgreSQL, if only one key or index is used, the SQL operator ``->`` is
|
On PostgreSQL, if only one key or index is used, the SQL operator ``->`` is
|
||||||
used. If multiple operators are used then the ``#>`` operator is used.
|
used. If multiple operators are used then the ``#>`` operator is used.
|
||||||
|
|
||||||
|
.. admonition:: SQLite users
|
||||||
|
|
||||||
|
On SQLite, ``"true"``, ``"false"``, and ``"null"`` string values will
|
||||||
|
always be interpreted as ``True``, ``False``, and JSON ``null``
|
||||||
|
respectively.
|
||||||
|
|
||||||
.. _containment-and-key-lookups:
|
.. _containment-and-key-lookups:
|
||||||
|
|
||||||
Containment and key lookups
|
Containment and key lookups
|
||||||
|
|
Loading…
Reference in New Issue