title: How to write separate views for GET and POST
body: <p>First of all I want both views use exact same URL because I don't want to make my URLConf more complicated. I want separate views for GET and POST to make my code cleaner. The code is something like this:</p>
  
  <pre><code>def view2 (request):
      # handle POST request, possibly a ajax one
      return HTTPRESPONSE(json_data, mimetype="Application/JSON")
  
  def view1 (request):
      if method == POST:
          view2(request)
          # What should I return here???
  
      else:
          # handle GET
          return render(request, template, context)
  </code></pre>
  
  <p>My question is about the <code># What should I return here???</code> line. If I don't put a return there, error occurs: </p>
  
  <blockquote>
    <p>not returning http response</p>
  </blockquote>
  
  <p>But I already return an HTTP response in view2. How can I make this work?</p>