title: Add "active" navigation class to navbar in Django's class-based views
body: <p>In a Django app, a lot of class-based views are called directly from the urls.py like so</p>
  
  <pre><code>url(r'^manage/thing/$',
      ListView.as_view(model=Thing,
                       queryset=Thing.objects.filter(parent=None)),
      name='mg_thing_list'),
  </code></pre>
  
  <p>and most CBVs are not subclassed, so views.py is almost empty. I want to highlight the active section in the navbar based on the URL. For example, pages at <code>/manage/thing/...</code> should have <code>class="active"</code> next to the "thing" item in the navbar HTML. What's the DRYest way of doing this? </p>
  
  <p>I want to avoid subclassing the CBVs just to add the request to the template context (which the standard templatetag solution seems to require). Currently we do it in a dumb way: add a <code>{% block %}</code> for every navbar item tag and set the relevant block to <code>class="active"</code> in each and every template. Seems a waste.</p>