#34641: Null value referenced from a JSONField using an expression that defines
an
output_field returns the string "null" instead of a None value
---------------------------------+--------------------------------------
Reporter: Daniel Schaffer | Owner: nobody
Type: Bug | Status: closed
Component: Uncategorized | Version: 3.2
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Changes (by Simon Charette):
* status: new => closed
* resolution: => invalid
Comment:
Setting `Case(output_field)` doesn't issue a `CAST`.
[https://docs.djangoproject.com/en/4.2/ref/models/database-functions/#cast
Using a proper] `Cast` should address your issue.
{{{#!python
Cast(Case(
When(
id__isnull=True,
then=F("data__test")
),
default=F("data__test"),
), IntegerField(null=True))
}}}
Please TicketClosingReasons/UseSupportChannels before filling a bug report
the next time.
Please use
--
Ticket URL: <https://code.djangoproject.com/ticket/34641#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/0107018897cc1ff2-2055dc7b-47c8-4a3a-b151-8076976d3d01-000000%40eu-central-1.amazonses.com.