[Fixed]-Per-view caching for get_queryset method in a class-based view (Django app)

1👍

It will be easier for you to achieve this by adding the caching in your URL config:

from django.views.decorators.cache import cache_page

url(r'^online/$', cache_page(20)(auth(OnlineView.as_view())), name='online'),

However I notice you have an auth() decorator on the same view. I’m not sure you want to be caching a view that requires authentication…

Leave a comment