Is it possible to search against one key value in the list of dictionaries using ILIKE (icontains) operator? My json field looks like this:
object = MyModel()
object.json_data = [
{
"type": 1,
"results": [
{
"score": 1,
"comment": "Some text comment 1",
},
{
"score": 2,
"comment": "Some text comment 2",
},
{
"score": 3,
"comment": "Some text comment 3",
}
]
},
{
"type": 2,
"results": [
{
"score": 4,
"comment": "Some text comment 4",
},
{
"score": 5,
"comment": "Some text comment 5",
},
{
"score": 6,
"comment": "Some text comment 6",
}
]
}
]
object.save()
And now, how to write the query to search in a "comment" key?
MyModel.objects.filter(json_data__??__results__??__comment__icontains="text comment")
I'm using Django 1.9.
Thanks!