I'm using Django 2.1 and I have model with JSONField(record):
{
'fields': [
{'tag': 'x','value': '12345'},
{'tag': 'y','value': '67890'}
]
}
To query exact 'value' I use:
Data.objects.filter(record__fields__contains=[{'tag':'x', 'value': '12345'}])
My question is, how to use regex with 'value'? e.g.
Data.objects.filter(record__fields__contains=[{'tag':'x', 'value': '/^123.*/'}])
you can simple:
see answer