Django passing a variable to Httpresponseredirect throws exception
<p>The problem I Have right now is that I get a :</p>

<p>Reverse for 'documentation' with arguments '(1,)' and keyword arguments '{}' not found. 0 pattern(s) tried: []</p>

<p>when I try to redirect to another view using HttpResponseRedirect</p>

<p>Here is my urls.py</p>

<pre><code>    url(r'^documentation/([0-9])/$', views.documents, name='documentation'),
</code></pre>

<p>here my views.py</p>

<pre><code>def view1(request):

  if request.method == 'POST':
      profe = request.POST.get('value')

      a = value.encode('ascii', 'ignore')
      b = int(a)
      return HttpResponseRedirect(reverse('documentation', args=(b,)))

  else:

      return render(request, "anhtml.html", info)

def documents(request,valor):
      ...something...
      return render(request, "anotherhtml.html", ..something..)
</code></pre>

<p>Thanks</p>

<p>template (anhtml.html)</p>

<pre><code>...
    &lt;form method="POST" action=""&gt;
        {% csrf_token %}
        {% for p in ps %}
        &lt;tr&gt;
            &lt;td&gt;&lt;button id="boton1" button type="submit" name = "valor" value ="{{p.idp}}" class="btn btn-success btn-sm"&gt;{{p.nombre}} {{p.apellido}}&lt;/button&gt;
            &lt;/td&gt;
            &lt;td&gt;algo&lt;/a&gt; &lt;/td&gt;
        &lt;/tr&gt;
        {%endfor%}
    &lt;/form&gt;
</code></pre>

<p>I think the problem is not with the HttpResponseRedirect, but with the call to reverse().</p>

<p>When you pass args, you should use the list notation for the values:</p>

<pre><code>return HttpResponseRedirect(reverse('documentation', args=[b]))
</code></pre>

<p>That should help, at least.</p>

python django