title: How to use Jinja in Django framework?
body: <p>I want to access the elements of a list using Jinja.</p>
  
  <p>Here in the below code both "id" and images are list.
  image_name is the field that stores the image</p>
  
  <pre><code>   {% for blog in id%}    
          &lt;h3&gt;{{blog.news_title}}&lt;/h3&gt;&lt;br/&gt;     
          &lt;a href="/blog/article/{{blog.slug}}"&gt;&lt;img src="images[loop.index0].image_name"/&gt;&lt;/a&gt;&lt;br/&gt;
          &lt;time&gt;{{blog.news_date}}&lt;/time&gt;&lt;br/&gt;
          &lt;a href="/blog/article/{{blog.slug}}"&gt;click here&lt;/a&gt;&lt;br/&gt;
      {% endfor%}&lt;/li&gt;
  </code></pre>
  
  <p>Views.py</p>
  
  <pre><code>def BlogViews(request,blog_type):
      """
          The blogs are displayed according to the latest, current-month and last-month classification
      """
      blog_type=blog_type.replace('-','_')
      response_blog=requests.get("API" % (settings.BASE_URL,blog_type),headers=headers,verify=False)
      if(response_blog.status_code==200):
          data_blog=response_blog.json()
          if(data_blog['ErrorCode']==0 and data_blog['SubErrorCode']==0):
              blog=BlogYearViews()
              blog_images=BlogImages(request,data_blog)
              return render(request,"CombinedBlog.html",{"id":data_blog['Data'],"years":blog,"images":blog_images})
          else:
              return render(request,"Page404.html")
  </code></pre>
  
  <pre><code>def BlogImages(request,data_blog):
      """
          Returns a list of all the images
      """
      data_image_list=[]
      for i in range(0,len(data_blog['Data'])):
          images=data_blog['Data'][i]['image_id']
          response_image=requests.get("API"%(settings.BASE_URL),headers=headers,verify=False)
          data_image=(response_image.json())
          data_image_list=data_image_list+data_image['Data']
      return (data_image_list)
  
  </code></pre>