﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
27205	Allow doing a substring search in JSONField array	Dean-Christian-Armada	nobody	"This is my models.py:


{{{
class Dog(models.Model):
    name = models.CharField(max_length=200)
    data = JSONField()

    def __unicode__(self):
        return self.name
}}}

I did this in the django shell:



{{{
Dog.objects.create(name='Rufus', data={ 'breed': 'labrador', 'owner': { 'name': 'Bob', 'other_pets': [{  'name': 'Fishy',  }], }, })
Dog.objects.create(name='Meg', data={'breed': 'collie'})
Dog.objects.filter(data__breed__contains='l')

}}}


However when I did the last command it gave me an empy queryset return:


{{{
<QuerySet []>

}}}


The two objects (Meg and Rufus) should have both returned because they both contain l

This is the query of the ORM:


{{{
SELECT ""post_tagging_dog"".""id"", ""post_tagging_dog"".""name"", ""post_tagging_dog"".""data"" FROM ""post_tagging_dog"" WHERE ""post_tagging_dog"".""data"" -> 'breed' @> '""l""'

}}}
"	New feature	closed	contrib.postgres	1.10	Normal	duplicate	postgresql, arrayfield		Accepted	0	0	0	0	0	0
