code: def treenav_undefined_url(request, item_slug):
      
      item = get_object_or_404(treenav.MenuItem, slug=item_slug)  # noqa
      # do something with item here and return an HttpResponseRedirect
      raise Http404
docs: Sample view demonstrating that you can provide custom handlers for
      undefined menu items on a per-item basis.