#31324: Filter JSONField using `=None`
-------------------------------------+-------------------------------------
     Reporter:  Nikolay Tretyak      |                    Owner:  Nikolay
                                     |  Tretyak
         Type:  Bug                  |                   Status:  assigned
    Component:  Database layer       |                  Version:  3.0
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Simon Charette):

 * cc: Simon Charette (added)


Comment:

 I remember a bit of discussion around the fact the `__isnull` lookup
 should be used for this purpose but in retrospection it certainly feels
 weird that the usual `field=None` and `field__isnull=True` symmetry is not
 honoured for `JSONField`.

 There's certainly a good reason for it because of the existence of the
 JSON's `null` type but given `field=None` insertion and updates result in
 SQL `NULL` and not JSON `null` it feels like `filter(field=None)` should
 default to SQL `NULL` and `filter(field=Value('null'))` should be used to
 target cases where `field=Value('null')` was used for insertions like in
 `test_json_null_different_from_sql_null`.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31324#comment:9>
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/067.a39970eac19d0eb142b27d55f023e546%40djangoproject.com.

Reply via email to