#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
-------------------------------------+-------------------------------------
Comment (by Carlton Gibson):
If we're going to conjecture, I think in reality most users set a default,
such as `dict`, so they don't have empty fields... — but I stand by point:
if you're using JSONField you're best off setting `null` as the empty
value, so all fields contain JSON.
For this ticket, the relevant point it that I don't think we should have
the API favour SQL-like usage over JSON-like usage. And I really don't
think `=None` should behave differently for the base field as against a
nested key. JSONFields aren't quite the same as other fields OK—can we doc
that better—but they should be internally consistent so if I'm using one,
I can have reasonable expectations about how they'll behave.
--
Ticket URL: <https://code.djangoproject.com/ticket/31324#comment:12>
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.e2adc2d1f79a05e1d04c166f02eec8e3%40djangoproject.com.