cache for list viewsets

38 views
Skip to first unread message

Thomas Alisi

unread,
Dec 14, 2016, 10:12:51 AM12/14/16
to Django REST framework
hi

trying to cache a list viewset attached to a router is proving harder than expected

I tried drf-extensions but the caching mechanism seems to disregard the query string, I opened a ticket here: https://github.com/chibisov/drf-extensions/issues/169

has anyone implemented other solutions for this? I did my research but couldn't find anything on this topic

cheers
Thomas

Timo Piirmann

unread,
Dec 16, 2016, 2:06:56 AM12/16/16
to Django REST framework
Hey

For me this simple way seems to work. Using latest versions of rest and extensions

from rest_framework.viewsets import ModelViewSet
from rest_framework_extensions.cache.mixins import ListCacheResponseMixin


class RandomViewSet(ListCacheResponseMixin, ModelViewSet):
 
...



Reply all
Reply to author
Forward
0 new messages