title: How does HttpResponse(status=<code>) work in django?
body: <p>I'm experimenting with HTTP error codes in django so I have a question about <code>HttpResponse(status=&lt;code&gt;)</code>. For example, I want to send a HTTP error code 405, I have the following code:</p>
  
  <pre><code>def myview(request):
     if request.method == 'POST':
        ...
     else:
        return HttpResponse(status=405)
  </code></pre>
  
  <p>Also I have my template for this HTTP error code (405.html) and I put the following code line in urls.py</p>
  
  <pre><code>handler405 = 'handling_error.views.bad_method'
  </code></pre>
  
  <p>And my bad_method view is the following:</p>
  
  <pre><code>def bad_method(request):
      datos_template = {}
      return render(request, '405.html', datos_template, status=405)
  </code></pre>
  
  <p>I thought in this way Django redirect to correct template according to the HTTP error code, but it doesn't work, then:</p>
  
  <p>Have I done incorrect something?
  How does HttpResponse(status=) work in django? 
  What is the goal of sending a HTTP error code through HttpResponse(status=)?</p>
  
  <p>Sorry, many questions :P</p>
  
  <p>I hope someone can help me.</p>