title: Why isn't Django rendering my block content or recognizing a logged in user?
body: <p>I have <code>base.html</code> which contains a <code>{%block bodycontent %}</code> and <code>{% endblock %}</code> tag, this template works everywhere else so far and resides in the project level templates directory.  Cool.</p>
  
  <p>Then, in an app specific template directory, I have <code>directory.html</code> which properly has the <code>{% extends 'base.html' %}</code></p>
  
  <p>However, there's two problems:  If I log in and go to the <code>/directory/</code> url my nav-bar (which is in the <code>base.html</code> template) doesn't show the user being logged in (navigating away from the page resume normal logged in user display of the nav-bar).</p>
  
  <p>So it looks like the <code>directory.html</code> template isn't receiving the user object and the <code>{% if user.is_authenticated %}</code> is failing and simply rendering the not logged in version.</p>
  
  <p>The other problem is that <code>directory.html</code> doesn't fill the <code>bodycontent</code> at all.  Or anything.  I've even inserted standard text and extra HTML tags to try to see something but nothing renders except the <code>base.html</code> template</p>
  
  <p><strong>project level urls.py</strong></p>
  
  <pre><code>urlpatterns = patterns('',
      url(r'^$', LandingPage.as_view(), name='home'),
      url(r'^accounts/', include('registration.backends.default.urls')),
      url(r'^about/', AboutPage.as_view(), name='about'),
      url(r'^login/', loginPage, name='login'),
      url(r'^logout/', logoutPage, name='logout'),
      url(r'^admin/', include(admin.site.urls), name='admin'),
      url(r'^register/', registrationPage, name='register'),
      url(r'^profile/', include(khusers_urlpatterns)),
      url(r'^directory/', displayDirectory, name = 'directory'),
      url(r'^addfriend/', AddFriend, name="add friend")
  )
  </code></pre>
  
  <p><strong>from the views.py</strong></p>
  
  <pre><code>@login_required
  def displayDirectory (request, options=None):
      """displays a list of public profile pages"""
      latestModUsers = KHPublicPage.objects.order_by('-lastModified')[:20]
      template = loader.get_template('khusers/directory.html')
      context = RequestContext(request, {'profiles': latestModUsers})
      return HttpResponse(template.render(context))
  </code></pre>
  
  <p><strong>directory.html</strong></p>
  
  <pre><code>{% extends 'base.html' %}
  
  {% block bodycontent %}
  
  {% comment %}
  Context expected:
      request.user as user
       a list of khusers.models.KHPublicPage as 'profiles'
  
          aboutMe
          displayName
  
  
  
  
  bootstrap glyphicons:
      use span class ="badge one of the following"
      glyphicon glyphicon-ok
      glyphicon glyphicon-remove
  {% endcomment %}
  &lt;div class="container"&gt;
      {% for person in profiles %}
      &lt;div class="panel panel-default"&gt;
          &lt;div class="panel-heading"&gt; {{person.displayName}} &lt;/div&gt;
          &lt;div class="panel-body"&gt;
              &lt;h4&gt; {{person.aboutMe}} &lt;/h4&gt;
              &lt;br /&gt;
              &lt;form action="/addfriend/" method="POST"&gt;
                  &lt;input type="hidden" value ="{{person.pk}}" name="requestee"&gt;
  
                  &lt;input type="text" name="note" placeholder="Let's be friends!"&gt;
                  &lt;button type="submit" class="btn btn-default"&gt;Add friend&lt;/button&gt;
              &lt;/form&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      {% endfor %}
  &lt;/div&gt;
  
  {% endblock %}
  </code></pre>
  
  <p><strong>base.html</strong></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
  &lt;meta charset="utf-8"&gt;
     &lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
      &lt;meta name="description" content=""&gt;
      &lt;meta name="author" content=""&gt;
  {% load static from staticfiles %}
  
  
  
  &lt;!-- pre headcontent django tag --&gt;
  {% block headcontent %}
  
  {% endblock %}
  &lt;!-- post headcontent django tag --&gt;
  &lt;title&gt;{% block title %} {% endblock %}
  &lt;/title&gt;
  
  &lt;link rel="stylesheet" type="text/css" href="{% static 'bootstrap/css/bootstrap.min.css' %}"&gt;
  &lt;link rel="stylesheet" type="text/css" href="{% static 'bootstrap/css/bootstrap-responsive.css' %}"&gt;
  &lt;link rel="stylesheet" type="text/css" href="{% static 'kh.css' %}"&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
  &lt;div class="navbar navbar-inverse navbar-fixed-top" role="navigation"&gt;
        &lt;div class="container"&gt;
          &lt;div class="navbar-header"&gt;
            &lt;button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"&gt;
              &lt;span class="sr-only"&gt;Toggle navigation&lt;/span&gt;
              &lt;span class="icon-bar"&gt;&lt;/span&gt;
              &lt;span class="icon-bar"&gt;&lt;/span&gt;
              &lt;span class="icon-bar"&gt;&lt;/span&gt;
            &lt;/button&gt;
  
            &lt;a class="navbar-brand" href="/"&gt;stuff&lt;/a&gt;
              &lt;ul class="nav navbar-nav"&gt;
                  &lt;li&gt;&lt;a class="" action="/about/"&gt;About&lt;/a&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;a class="" action="/support/"&gt;Other Things&lt;/a&gt;&lt;/li&gt;
              &lt;/ul&gt;
          &lt;/div&gt;
          &lt;div class="navbar-collapse collapse"&gt;
              {% if user.is_authenticated %}
  
                  &lt;a class="btn btn-default navbar-btn navbar-right btn-danger" style="margin-left: 10px;" href="/logout/"&gt;Logout &lt;/a&gt;
                  &lt;a class="btn btn-default navbar-btn navbar-right btn-info" style="margin-left: 10px;" href="/profile/" &gt; {{user.username}}&lt;/a&gt;
              {% else %}
              &lt;a class="btn btn-default navbar-btn navbar-right khtopbarbuttons" style="margin-left: 10px;" href="/register/"&gt;Register&lt;/a&gt;
                  &lt;form class="navbar-form navbar-right khtopbarbuttons" role="form" action ='/login/' method='post'&gt;
                      {% csrf_token %}
                      &lt;div class="form-group" style="margin-right: 10px;"&gt;
                          &lt;input type="text" placeholder="username" class="form-control" name="username" style="margin-left: 10px;"&gt;
                      &lt;/div&gt;
                      &lt;div class="form-group" style="margin-right: 10px;"&gt;
                          &lt;input type="password" placeholder="Password" class="form-control" name="password" style="margin-left: 10px;"&gt;
                      &lt;/div&gt;
                      &lt;button type="submit" class="btn btn-success" style="margin-left: 10px;"&gt;Sign in&lt;/button&gt;
                  &lt;/form&gt;
  
              {% endif %}
          &lt;/div&gt;&lt;!--/.navbar-collapse --&gt;
        &lt;/div&gt;
      &lt;/div&gt;
  
  
      &lt;div class="container khcontainerpadded"&gt;
  
                  &lt;!-- Pre bodycontent django tag --&gt;
                  {% block bodycontent %}
  ?
                  {% endblock %}
                  &lt;!-- post bodycontent django tag --&gt;
      &lt;/div&gt;
  &lt;script src="{{ STATIC_URL }}jquery-1.10.2.js"&gt;&lt;/script&gt;
  &lt;script src="{{ STATIC_URL }}bootstrap/js/bootstrap.js"&gt;&lt;/script&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>