title: django help login check
body: <p>view.py</p>
  
  <pre><code>username = request.POST['username']
  password = request.POST['password']
  
  user = authenticate(username=username, password=password)
  if user is not None:
      if user.is_active:
          login(request, user)
          return redirect('index')
  </code></pre>
  
  <p>login success my view.py</p>
  
  <p>global_header.html</p>
  
  <pre><code>{% if user.is_authenticated %}
      &lt;p&gt;Welcome, {{ user.username }}. Thanks for logging in.&lt;/p&gt;
  {% else %}
      &lt;p&gt;Welcome, new user. Please log in.&lt;/p&gt;
  {% endif %}
  </code></pre>
  
  <p>However, login verification is not possible globally there are two
  cases.</p>
  
  <pre><code>return render(request, page_name, param) # if user.is_authenticated return True
  </code></pre>
  
  <p>if another case.</p>
  
  <pre><code>return HttpResponse(page.render(param)) # if user.is_authenticated return False
  </code></pre>
  
  <p>So I can not use HttpResponse?</p>