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:
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)
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?