don't use it on *DISPATCH*. use on *GET* or *POST* instead @method_decorator(cache_page(60*60*2)) def list(self, *args, **kwargs): return super().list(*args, **kwargs)
On Friday, March 6, 2020 at 5:15:09 PM UTC+7 [email protected] wrote: > i try to cache ModelViewSet: > > my view is : > > class CommentsViewSet(ModelViewSet): > queryset = CommentsModel.objects.all() > serializer_class = CommentsALLSerializer > http_method_names = ['get'] > permission_classes = (AllowAny,) > > > > i try this but not work: > > @method_decorator(cache_page(60*60)) > def dispatch(self, *args, **kwargs): > return super().dispatch(*args, **kwargs) > > > how to deal with it ? > > > > > > > > > > > > > > > > > -- You received this message because you are subscribed to the Google Groups "Django REST framework" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/django-rest-framework/38c67cd0-0c7f-4ea1-8216-45e2ed83027an%40googlegroups.com.
