title: Clarification on the statement if request.Post: in django
body: <p>Suppose I have a view like this: </p>
  
  <pre><code>def home(request, redir_url, template = 'example/home.html')
      if request.session["profile_name"] and request.session["token"]:
              return HttpResponseRedirect(redir_url)
      if request.POST:
          driver = Facebook()
          res = driver.RetLoginUrl(redir_url)
          return HttpResponseRedirect(res)
  
      return render(request, template)
  </code></pre>
  
  <p>In this view, first I check the session variables, if the user has already logged in, I redirect to the welcome page, and if not I have a login button with which the user can authorize my app with Facebook.</p>
  
  <p>And the template has a form method=POST with the login button as input.</p>
  
  <p>My question is, how does the if statement (if request.POST) get executed, when there is a statement return render(request, template) at the end of the view. After the page is rendered, i.e. return render() statement has been executed, shouldn't the view function terminate, hence without a form response being submitted to the view?</p>
  
  <p>Basically, I just would like to understand the execution flow of a django view. Is the return render() statement executed first, and then waits for user input?</p>