title: Django templates - if statement before displaying a {% block %} tag not working properly?
body: <p>This is my basic html page which my other html pages extend off of (it is called base.html):</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html&gt;
  
      &lt;head&gt;
          &lt;title&gt;Django Bookmarks | {% block title %}{% endblock %}&lt;/title&gt;
          &lt;link rel='stylesheet' type='text/css' href='/site_media/css/style.css' /&gt;
      &lt;/head&gt;
  
      &lt;body&gt;
  
          {% block header %}
              &lt;p&gt; signed in! &lt;/p&gt;
          {% endblock %}
  
          {% block content %}{% endblock %}
  
      &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>Now, this is my main page. </p>
  
  <pre><code>{% extends "base.html" %}
  
  {% block title %} Title {% endblock %}
  
  {% if user.username %}
  {% else %}
      {% block header %}{% endblock %}
  {% endif %}
  
  {% block content %}
      {% if user.username  %}
          &lt;p&gt;Welcome {{ user.username }}.&lt;/p&gt;
      {% else %}
          &lt;p&gt;Not Signed in&lt;/p&gt;
      {% endif %}
  {% endblock %}
  </code></pre>
  
  <p>as you can see, I want my </p>
  
  <pre><code>{% block header %}{% endblock %}
  </code></pre>
  
  <p>to be empty if no user is signed in, but if there is a user signed in, I want the </p>
  
  <pre><code>{% block header %}
  </code></pre>
  
  <p>to inherit from base.html. However, it does not inherit from base.html even when a user is signed in. The header block does not show when the user is signed in. Any idea why?</p>