Yesterday I had a Stackoverflow question about putting a permissioning check on a class-based-view. The solution seem(s) to be incorporating a PermissionDeniedMixin
. It also looks like I could try UserPassesTestMixin
from Django-braces.
This made sense, but I was doing some background reading on the dispatch()
method and stumbled onto this part of the documentation:
To decorate every instance of a class-based view, you need to decorate the class definition itself. To do this you apply the decorator to the dispatch() method of the class.
Why would I need or choose to decorate the instances with the permission mixins rather than the class itself?