Refs #32483 -- Doc'd caveat about using JSONField key transforms to booleans with QuerySet.values()/values_list() on SQLite.

This commit is contained in:
Mariusz Felisiak 2021-03-04 11:30:06 +01:00 committed by GitHub
parent 05bbff8263
commit c6b07627fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 0 deletions

View File

@ -695,6 +695,12 @@ 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:: Boolean values for ``JSONField`` on SQLite
Due to the way the ``JSON_EXTRACT`` SQL function is implemented on SQLite,
``values()`` will return ``1`` and ``0`` instead of ``True`` and ``False``
for :class:`~django.db.models.JSONField` key transforms.
``values_list()`` ``values_list()``
~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~
@ -765,6 +771,12 @@ 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:: Boolean values for ``JSONField`` on SQLite
Due to the way the ``JSON_EXTRACT`` SQL function is implemented on SQLite,
``values_list()`` will return ``1`` and ``0`` instead of ``True`` and
``False`` for :class:`~django.db.models.JSONField` key transforms.
``dates()`` ``dates()``
~~~~~~~~~~~ ~~~~~~~~~~~