title: django - how to add counter into {{ }} tag through a template for loop
body: <p>views.py:</p>
  
  <pre><code>def main(request):
      users = PUser.objects.filter(ostan=os, shahr=sh, content_id=content)
      return render(request, 'main.html', {'users': users})
  </code></pre>
  
  <p>In main.html file:</p>
  
  <pre><code>&lt;a href="#"&gt;{{ users.0.website }}&lt;/a&gt;
  .
  .
  .
  &lt;a href="#"&gt;{{ users.1.website }}&lt;/a&gt;
  .
  .
  .
  &lt;a href="#"&gt;{{ users.2.website }}&lt;/a&gt;
  .
  .
  .
  &lt;a href="#"&gt;{{ users.3.website }}&lt;/a&gt;
  </code></pre>
  
  <p>Now I want to put it through a for loop. So I added this line:</p>
  
  <pre><code>numbers = [1, 2, 3, 4]
  </code></pre>
  
  <p>to views.py, and edited main.html like this:</p>
  
  <pre><code>{% for each in numbers %}
      &lt;a href="#"&gt;{{ users.0.website }}&lt;/a&gt;
  {% enfor %}
  </code></pre>
  
  <p>But I dont know how to edit <code>{{ users.0.website }}</code> part!</p>
  
  <p>I tried <code>{{ users.each.website }}</code> but it didnt print anything. How should I change it?</p>