title: django lookups that span relationships - how to
body: <p>I have an Address Model which has a ForeignKey to a Contact Model:</p>
  
  <pre><code>class Address(models.Model):
      street = models.CharField(max_length=25)
      postal_code = models.CharField(max_length=25)
      city = models.CharField(max_length=50)
      country = models.CharField(max_length=50)
      contact = models.ForeignKey(Contact, related_name='address to contact')
  
  class Contact(models.Model):
      salutation = models.CharField(max_length=1, choices=salutation_choices, verbose_name="salutation")
      title = models.ForeignKey(Title, blank=True, null=True)
      ...
  </code></pre>
  
  <p>Now I want to filter my Contact objects based on data from the address object.
  Therefore I want to create a filter that span a relationship, following this part of the docu:</p>
  
  <p><a href="http://docs.djangoproject.com/en/1.1/topics/db/queries/#lookups-that-span-relationships" rel="nofollow noreferrer">lookup that span relationship</a></p>
  
  <p>I tried it like this:</p>
  
  <pre><code>result_set = Contact.objects.filter(address__street__contains='mystreet')
  </code></pre>
  
  <p>I'm getting the following error message:</p>
  
  <pre><code>Cannot resolve keyword 'address' into field. Choices are: address to contact, birthdate..
  </code></pre>
  
  <p>Actually the error message tells me that there is a field address to contact, but the question is how can I reference it?</p>