From 5ab1b7bc26b18496b296dc9766fcbdfe7f7a585c Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Thu, 4 Mar 2021 11:30:06 +0100 Subject: [3.1.x] Refs #32483 -- Doc'd caveat about using JSONField key transforms to booleans with QuerySet.values()/values_list() on SQLite. Backport of c6b07627fcb5d1c8d2082714ef5adb63bee6cf4c from master --- docs/ref/models/querysets.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'docs/ref') diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt index d807fd4f08..dbf7b35688 100644 --- a/docs/ref/models/querysets.txt +++ b/docs/ref/models/querysets.txt @@ -645,6 +645,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, 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()`` ~~~~~~~~~~~~~~~~~ @@ -715,6 +721,12 @@ not having any author:: >>> Entry.objects.values_list('authors') +.. 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()`` ~~~~~~~~~~~ -- cgit v1.3