title: Django - Highlight Navigation based on current page?
body: <p>I am building a webapp that has several main sections. Each section has several sub-sections. I have a <code>main_nav.html</code> file that holds the nav for the main section. This is added to the based <code>HTML</code> file with the <code>{% include ... %}</code> command in the <code>base.html</code> template. Further, I  have several sub-section nav files, each of which are added to any given page with the same <code>{% include ... %}</code> command. </p>
  
  <p>All the nav bars are very simple, just text with <code>&lt;a href...&gt;</code> tags. </p>
  
  <p>I want to highlight the link for the current main section and the current sub-section. Since this webapp is rather big, I was hoping to somehow do this without adding page-specific information. Plus, I want it to just "work" as the webapp expands to include more sections and sub-sections. For example, could this be done by looking at the actual URL in use? I was hoping to put this could within the nav files themselves and not have to load some variable or whatever within every django view.</p>
  
  <p>So, for example, the nav looks like this:</p>
  
  <pre><code>(main -&gt;)            [Systems][Invoices][Work Orders][Admin]
  (system sub-nav -&gt;)  [Owner][Billing][Contacts]
  </code></pre>
  
  <p>So if I am in the <code>Billing</code> section of <code>Systems</code>, I want the link <code>Systems</code> in bold and the link <code>Billing</code> to be bold (or some other simple highlight)</p>
  
  <p>Or:</p>
  
  <pre><code>(main -&gt;)                 [Systems][Invoices][Work Orders][Admin]
  (Work-Orders sub-nav -&gt;)  [Create New][Outstanding]
  </code></pre>
  
  <p>If I am in the <code>Outstanding</code> section of <code>Work Orders</code>, the link <code>Work Orders</code> and the link <code>Outstanding</code> needs to be highlighted. </p>
  
  <p>Any ideas?</p>