I\'m trying to do cache_page with class based views (TemplateView) and i\'m not able to. I followed instructions here:
Django--URL Caching Failing for Class Based Vi
You can simply decorate the class itself instead of overriding the dispatch method or using a mixin.
For example
from django.views.decorators.cache import cache_page
from django.utils.decorators import method_decorator
@method_decorator(cache_page(60 * 5), name='dispatch')
class ListView(ListView):
...
Django docs on decorating a method within a class based view.