As far as I know you can't use __isnull
lookups on django native JSONField
. On the Internet I found this inactive issue.
As possible workaround we can of course use these hacks:
model.objects.filter(field__contains={'key': None})
, which isn't so flexible since you might need to query multiple keys or whatever.model.objects.exclude(field__key=True).exclude(field__key=False)
, which is hacky and works only for boolean data.
I hope there is a better way ((c) Raymond Hettinger) of doing this. Any advises will be appreciated. For now, I will go with the first approach