[Django]-Django queryset filter empty JSONField

4👍

Found a way to achieve using iexact:

MyObject.objects.filter(my_field__iexact="{}")
👤Othman

0👍

according to the docs you can use

MyModel.objects.include(myjsonfield__exact=[])
MyModel.objects.exclude(myjsonfield__exact=[])
👤pymen

Leave a comment