title: Accessing a context object in a Django class-based generic view
body: <p>I'm using a DetailView to view a Project object, and I would like to be able to access the Project object being viewed in order to pass it to a decorator, something like this:</p>
  
  <pre><code>class ProjectDetailView(DetailView):
      context_object_name = "project"
      model = Project
  
      @method_decorator(membership_required(project))
      def dispatch(self, *args, **kwargs):
          return super(ProjectDetailView, self).dispatch(*args, **kwargs)
  </code></pre>
  
  <p>However, passing in "project" or "object" to the decorator gives me an "object", not a Project instance. How can I get that Project instance so my decorator function can work with it?</p>