title: How to refresh page for new request in Django
body: <p>I want to receive a request.POST values N times, where N is a number entered by the user. The views.py is:</p>
  <pre class="lang-py prettyprint-override"><code>def valores(request):
      global peso_unitario, preco_unitario
      peso_unitario = []
      preco_unitario = []
  
      N = a
      print('N=' + str(N))
  
      for i in range(N):
          form = Form(request.POST)
          c = int(request.POST.get('peso_u'))
          d = int(request.POST.get('preco_u'))
          peso_unitario.append(c)
          preco_unitario.append(d)
  
          return render(request, 'valores.html')
      return render(request, 'pacote_m.html', {'peso_unitario': peso_unitario, 'preco_unitario': preco_unitario})
  </code></pre>
  <p>In this code in the end I have two returns, where the first is inside the for loop because I want to receive the values N times and return them to the template <code>valores.html</code>. The last return is in the end, after the for loop will redirect to a new template, this template <code>pacote.html</code> will show the values calculated according to I programmed, but it isn't the problem.</p>
  <p>The template <code>valores.html</code> is:</p>
  <pre class="lang-html prettyprint-override"><code>{% extends 'basic.html' %}
  
  {% block content %}
  
  &lt;form action=&quot;page2&quot; method=&quot;GET&quot;&gt;
      {% csrf_token %}
  
      &lt;h1&gt;Digitados:&lt;/h1&gt;
      numero de objetos={{n_objetos}}&lt;br&gt;
      peso peso maximo={{peso_maximo}}&lt;br&gt;
  
      &lt;!--- Peso unitario: &lt;input type=&quot;text&quot; name=&quot;peso_u&quot;&gt;&lt;br&gt;&lt;br&gt;
      Preco unitario: &lt;input type=&quot;text&quot; name=&quot;preco_u&quot;&gt;&lt;br&gt;&lt;br&gt; ---&gt;
  
  
      &lt;table&gt;
        &lt;thead&gt;
          &lt;tr&gt;
            &lt;th&gt;Peso unitario&lt;/th&gt;
            &lt;th&gt;Preco unitario&lt;/th&gt;
          &lt;/tr&gt;
        &lt;/thead&gt;
        &lt;tbody&gt;
          &lt;tr&gt;
            &lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;peso_u&quot;&gt;&lt;/td&gt;
            {{form.peso_u}}
            &lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;preco_u&quot;&gt;&lt;/td&gt;
            {{form.preco_u}}
          &lt;/tr&gt;
      &lt;/table&gt;
      &lt;input type=&quot;submit&quot;&gt;
  &lt;/form&gt;
  
  {% endblock %}
  </code></pre>
  <p>My forms.py is:</p>
  <pre><code>class Form(forms.Form):
      peso_u = forms.CharField(max_length=50)
      preco_u = forms.CharField(max_length=50)
  </code></pre>
  <p>The problem is I can't get the <code>N</code> request.POST values. I realized that it gets only once the request.POST values, the following requests substitute the values entered before and it will continue in the loop, I realized that the loop is forever because it will request more than <code>N</code> times the values, maybe because it substitute the value entered before.</p>