title: How to get image connected by Foreign Key via Template in django
body: <p>i want to get the images form the image model in the template. </p>
  
  <pre><code>class Products(models.Model):
      category = models.ForeignKey(Category)
      name= models.CharField(max_length=120, unique=True)
      slug = models.SlugField(unique = True)
      price = models.IntegerField(default=100)
  
  
  class Image(models.Model):
      property = models.ForeignKey(Products, related_name='images')
      image = models.ImageField(upload_to='static/images/home',blank=True,null=True)
  </code></pre>
  
  <p>views.py </p>
  
  <pre><code>def index(request):
    queryset = Products.objects.all()
    return render_to_response('site/index.html',
                              locals(),
                              context_instance=RequestContext(request))
  
  
  
  {% for query in queryset %} 
     &lt;img src='/ {{ query.????? }} ' alt="" width = 'auto' height='340'/&gt;
  {% endfor %}
  </code></pre>
  
  <p>i want to get the images which is connected to that product </p>
  
  <p>i have readed that <a href="https://stackoverflow.com/questions/11056844/django-how-to-get-data-connected-by-foreignkey-via-template">link</a> </p>
  
  <p>i have tried:</p>
  
  <pre><code>{% for query in queryset %} 
     &lt;img src='/ {{ query.images_all.0.image }} ' alt="" width = 'auto' height='340'/&gt;
  {% endfor %}
  </code></pre>
  
  <p>but no success ..</p>