title: Navigation menu using Django templates
body: <p>Trying to work with a trivial navigation menu using django templates, I'm having trouble setting the current class on a particular menu item. Here's my base template:</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
      &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
      &lt;head&gt;
   &lt;title&gt;{% block title %}{% endblock %}&lt;/title&gt; 
   &lt;meta http-equiv="content-type" content="text/html;charset=utf-8" /&gt;
   &lt;link rel="stylesheet" type="text/css" href="/media/css/base.css" /&gt;
   &lt;link rel="stylesheet" type="text/css" href="/media/css/login.css" /&gt;
   &lt;link rel="stylesheet" href="/site_media/css/style.css" type="text/css" /&gt;
   &lt;!--[if lte IE 7]&gt;&lt;link rel="stylesheet" type="text/css" href="/media/css/ie.css" /&gt;&lt;![endif]--&gt;
  &lt;/head&gt;
   &lt;body class="{% block bodyclass %}{% endblock %}"&gt;
   {% block content %}{% endblock %} 
   {% block footer %}{% endblock %}
  &lt;/body&gt; 
  &lt;/html&gt;
  </code></pre>
  
  <p>Then I have a nav.html:</p>
  
  <pre><code> &lt;ul id="top"&gt;
     &lt;li&gt;&lt;a class="{% block home %}{% endblock %}" href="/"&gt;Home&lt;/a&gt;&lt;/li&gt;
     &lt;li&gt;&lt;a class="{% block myaccount %}{% endblock %}" href="/profile/"&gt;My Account&lt;/a&gt;&lt;/li&gt;
     {% if perms.staffing.add_staffrequest %}
      &lt;li&gt;&lt;a class="{% block createsr %}{% endblock %}" 
       href="/create/staffrequest/"&gt;Staff Request&lt;/a&gt;&lt;/li&gt;
     {% endif %}
    &lt;/ul&gt;
  </code></pre>
  
  <p>And now in my home.html, I can't seem to get the class current to display:</p>
  
  <pre><code>{% extends "base.html" %}
  {% block title %}Home Portal{% endblock %}
  {% block content %}
  
  &lt;div id="content"&gt;
   {% include "nav.html" %}
      {% block home %}current{% endblock %} 
   &lt;div id="intro"&gt;
    &lt;p&gt;Hello, {{ user.first_name }}.&lt;/p&gt;
    &lt;p&gt;Please create a Staff Request here by filling out the form
    below.&lt;/p&gt;
   &lt;/div&gt; &lt;!-- end intro --&gt;
   &lt;div id="logout"&gt;
    &lt;a href="/accounts/logout" alt="Sign Off" title="Sign Off"&gt;Sign Off&lt;/a&gt;
   &lt;/div&gt;
  &lt;/div&gt; &lt;!-- end content --&gt;
  
  {% endblock %}
  </code></pre>
  
  <p>The class 'current' isn't showing up in navigation for the appropriate element, letting me set visual context for a user depending what page they're on.</p>