title: Django is it better to check user.is_authenticated in views.py or in template?
body: <p>I have a homepage, which I want to display a login form when user is not logged in or display a list of items belong to that user if he/she already logged in. </p>
  
  <p>So far I came up with 2 methods:</p>
  
  <ol>
  <li><p>Check whether user is authenticated in views.py and render corresponding view (in my <em>views.py</em>):</p>
  
  <pre><code>if request.user.is_authenticated():
      return render(request, 'items.html')
  else
      return render(request, 'login.html')
  </code></pre></li>
  <li><p>Check directly in template and generate corresponding HTML for each case (in my <em>index.html</em>):</p>
  
  <pre><code>{% if user.is_authenticated %}
      HTML for my items list
  {% else %}
      HTML for my login form
  {% endif %}
  </code></pre></li>
  </ol>
  
  <h3>Question</h3>
  
  <p>So which method is better for handling this? Are those methods differ much in performance? Is there any standard that we should handling these in <strong>views.py</strong> or in template itself?</p>