passing parameters through url to view django
<p>I'm having some difficulty passing values to my view through url.</p>

<p>So far, I've managed to run my view without any issues. </p>

<p>view.py (draws a graph):</p>

<pre><code>def draw(request)
    ....
    ....
    return HttpResponse (buffer.getvalue(), content_type="Image/png")
</code></pre>

<p>but I need my view to take input from users, so I edited it and added an extra parameter:</p>

<pre><code>def draw(request, loan_amount)
     loanAmount = loan_amount
     .....
</code></pre>

<p>The user input is passed from a form, to another view:</p>

<pre><code>def search_member(request):
     loanAmount = request.GET.get('desired_loan')
     return render(request, 'blog/search_member.html', {'loanAmount':loanAmount)
</code></pre>

<p>In my template, I insert the user input in the draw's parameter:</p>

<pre><code>&lt;img src="http://test.com/graph/{{ loanAmount }}"&gt;
</code></pre>

<p>This is suppose to draw an image base on the user input, instead I get no image at all.</p>

<p>If I remove the parameter, the image works fine. I'm assuming I'm doing something wrong with the setup of the parameter, most likely in the template, or url:</p>

<pre><code>url(r'^graph/(?P&lt;desired_loan&gt;\d+)/$', views.draw, name='draw'),
</code></pre>

<p>I have tested the view, form and everything else, they all work. How can I narrow down this problem to find the solution?</p>

<p>Any direction/help would be appreciated,</p>

<p>thanks,</p>

<pre><code>&lt;form method="GET" action="/search_member/" class="navbar-form pull-left"&gt;

            &lt;input type="number" step = "any" id="searchBox" class="input-medium search-query" name="desired_loan" placeholder="Desired Loan"&gt;&lt;br&gt;
            &lt;input type="number" step = "any" id="searchBox" class="input-medium search-query" name="repayment_time" placeholder="Payment Time"&gt;&lt;br&gt;

            &lt;input type="submit" class="btn" value="Draw Graph" &gt;

        &lt;/form&gt;&lt;br&gt;
        &lt;img src="http://test.com/graph/{{ loanAmount }}"&gt;
</code></pre>

<p>screen shot:</p>

<p><a href="https://i.stack.imgur.com/ow0J6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ow0J6.png" alt="The picture doesn&#39;t show"></a></p>