Django Python, Form show the csrf token
<p>I'm trying to make a variable form in django but it seems not 
working properly, I hope you can help me because i show me the token instead of form values.</p>

<p><a href="http://i.stack.imgur.com/ARP7l.png" rel="nofollow"><img src="http://i.stack.imgur.com/ARP7l.png" alt="enter image description here"></a></p>

<p><strong>Help me please!</strong></p>

<p>url.</p>

<pre><code>url(r'^test', views.test),
</code></pre>

<p>views.</p>

<pre><code>def test(request):
    if request.method == "POST":
        for key, value in request.POST.items():
            response = '%s %s' % (key, value)

        return HttpResponse(response)




    return render(request, 'datos2.html')
</code></pre>

<p>datos2.</p>

<pre><code>&lt;form action="/test" method="post"&gt; {% csrf_token %}
&lt;input type="text" name="eee"&gt;
&lt;input type="submit"&gt;
&lt;/form&gt;


&lt;p&gt;ADD VALUE&lt;/p&gt;

&lt;button onclick="myFunction()"&gt;ADD&lt;/button&gt;

&lt;script&gt;
function myFunction() {
    var x = document.createElement("INPUT");
    x.setAttribute("type", "text");
    x.setAttribute("value", "0");
    x.setAttribute("name", "eee");
    document.body.appendChild(x);
}
&lt;/script&gt;
</code></pre>

<p><a href="http://i.stack.imgur.com/WyzCp.png" rel="nofollow"><img src="http://i.stack.imgur.com/WyzCp.png" alt="enter image description here"></a></p>

<p><a href="http://i.stack.imgur.com/67MhH.png" rel="nofollow"><img src="http://i.stack.imgur.com/67MhH.png" alt="enter image description here"></a></p>

<p><a href="http://i.stack.imgur.com/CBABH.png" rel="nofollow"><img src="http://i.stack.imgur.com/CBABH.png" alt="enter image description here"></a></p>

<p>Help me please!</p>

<p>In order to obtain values from form you should retrieve them from your request object and return in form of context as a part of your rendered template. Here what your code accomplish currently: </p>

<p>Check method of the request</p>

<pre><code>if request.method == "POST":
</code></pre>

<p>Assign to variable response values from POST dictionary, but next value in dictionary overwrites previous one, so as a result, result is last item from POST dictionary, which is csrf token value </p>

<pre><code>for key, value in request.POST.items():
            response = '%s %s' % (key, value)
</code></pre>

<p>Here you return whatever is in your response variable as a http response. You are not rendering template at this step. You just return content of your variable as a response.</p>

<pre><code>return HttpResponse(response)
</code></pre>

<p>And, consequently, execution flow will never reach this statement:</p>

<pre><code>return render(request, 'datos2.html')
</code></pre>

<p>This is it. </p>

<p>I'm not sure i understand you question properly, but if you use post method it means you want to receive values from form. You can do it like this:</p>

<pre><code>if 'name_of_your_html_input_field' in request.POST:
                  result=request.POST.get('name_of_your_html_input_field')
return render(request, "template_name.html", {'data':result})
</code></pre>

<p>And in your template you should:
Put <code>{{data}}</code> somewhere.</p>

python django forms token