title: django dynamic select_related in template
body: <p>I got two models: </p>
  
  <pre><code>class Location(models.Model): 
      location_id=models.AutoField(primary_key=True)
      location=models.CharField(max_length=30, blank=False, null=False)
      phone_code=models.CharField(max_length=10,blank=True, null=True)
      def __str__(self):
         return self.location
  
  class Host(models.Model): 
      host_id=models.AutoField(primary_key=True)
      location=models.ForeignKey('Location', on_delete=models.CASCADE)
      host=models.CharField(max_length=30, blank=False, null=False)
      def __str__(self):
      return "%s. %s" % (self.location.location, self.host)
  </code></pre>
  
  <p>it's a view for my template:</p>
  
  <pre><code>def index(request):
      locations=Location.objects.order_by('location')
      hosts=Host.objects.order_by('host')
      template=loader.get_template('ports/index.html')
      return HttpResponse(template.render({'locations':locations, 'hosts':hosts},request))
  </code></pre>
  
  <p>I want to place two input selects in template, like this:</p>
  
  <pre><code>  &lt;select class="form-control" id="location"&gt;
     {% for location in locations %}
      &lt;option&gt;{{location.location}}&lt;/option&gt;
     {% endfor %}  
    &lt;/select&gt;
    &lt;select class="form-control" id="host"&gt;
          ?????? dynamic update depending on location's select
    &lt;/select&gt;
  </code></pre>
  
  <p>And the second select will contain host. I need host's select to update dynamically when I change value in location's select. </p>