title: Django Foreign Keys connections
body: <p>I have a model Field that has a OneToMany connections with TreeSensor and WeatherStation model. Im trying to pass over the queries of each treesensor/weatherstation model that match the id of each different field but get a <code>Field 'id' expected a number but got &lt;built-in function id&gt;.</code> .How do i fix that? Maybe change something on the <code>filter</code> ?</p>
  <pre><code>class Field(models.Model):
      user = models.ForeignKey(User, on_delete=models.CASCADE, blank=True, null=True, default=None)
      friendly_name = models.CharField(max_length=24, blank=True)
      soil_type = models.CharField(max_length=24, choices=SOIL_TYPES, blank=True)  
      cultivation = models.CharField(max_length=128, choices=CULTIVATIONS, blank=True)  
      kml = models.FileField(upload_to = user_directory_path_kml, null=True, blank=True)
  
  class TreeSensor(models.Model):  
      field = models.ForeignKey(Field, on_delete=models.CASCADE)
      ...
  
  class WeatherStation(models.Model):
      field = models.ForeignKey(Field, on_delete=models.CASCADE)
      ...
  </code></pre>
  <p><strong>view</strong></p>
  <pre><code>def map(request):
      field_list = models.Field.objects.filter(user = request.user)
      tree_sensors = models.TreeSensor.objects.filter(field__pk = id)
      weather_stations = models.WeatherStation.objects.filter(field__pk = id)
      context = {
          &quot;title&quot;: &quot;Map&quot;,
          &quot;field_list&quot;: field_list,
          &quot;tree_sensors&quot;: tree_sensors,
          &quot;weather_stations&quot; : weather_stations,
      }
      template = 'agriculture/map.html'
      return render(request, template, context)
  </code></pre>