django filter queryset based on __str__ of model
<p>I have the following model:</p>

<pre><code>class Subspecies(models.Model):
    species = models.ForeignKey(Species)
    subspecies = models.CharField(max_length=100)

    def __str__(self):
        return self.species.species_english+" "+self.species.species+" "+self.subspecies

    def __unicode__(self):
        return self.species.species_english+" "+self.species.species+" "+self.subspecies
</code></pre>

<p>Notice that the ForeignKey field, <code>species</code> is used in the <code>__str__</code> and <code>__unicode__</code> methods.  I had made this filter query:</p>

<pre><code>l = list(Subspecies.objects.filter(subspecies__contains=request.GET.get('term')).order_by('subspecies')[:10])
</code></pre>

<p>This is almost what I want, except not quite.  What I really want is a filter that checks if the <code>__str__</code> representation of the object contains some group of characters, instead of just checking the <code>subspecies</code> field.  Instead of <code>subspecies__contains=...</code> it would be something like <code>__str____contains=...</code> but of course that doesn't work.</p>

<p>Is this possible?  IF so how would I make this query?</p>

<p>Thanks!</p>