Django Postgres ArrayField __contain lookup does not behave expectedly
<p>This is my <em>models.py</em>:</p>

<pre><code>class Dog(models.Model):
    name = models.CharField(max_length=200)
    data = JSONField()

    def __unicode__(self):
        return self.name
</code></pre>

<p>I did this in the django shell:</p>

<pre><code>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')
</code></pre>

<p>However when I did the last command it gave me an empy queryset return:</p>

<pre><code>&lt;QuerySet []&gt;
</code></pre>

<p>The two objects <em>(Meg and Rufus)</em> should have both returned because they both contain l</p>

<p>This is my query:</p>

<pre><code>SELECT "post_tagging_dog"."id", "post_tagging_dog"."name", "post_tagging_dog"."data" FROM "post_tagging_dog" WHERE "post_tagging_dog"."data" -&gt; 'breed' @&gt; '"l"'
</code></pre>

<p>try simply <code>for + if</code>:</p>

<pre><code>for obj in Dog.objects:
    if 'l' in obj.data['breed']:
        return obj
</code></pre>

python django