Hi Ali,
Have you tried cacheops ?
https://github.com/Suor/django-cacheops
It makes caching very easy.
Anne-Sophie

On Fri, Mar 6, 2020 at 2:15 AM ali marefati <[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/605c8643-53eb-456a-afba-e102ca44dd97%40googlegroups.com
> <https://groups.google.com/d/msgid/django-rest-framework/605c8643-53eb-456a-afba-e102ca44dd97%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Anne-Sophie Le Bloas

-- 
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/CAMD%2BB6BrS9mV%3DTka4PZpnqpKw4HubrziRh%2Bp_DDOy6NvLk-Mwg%40mail.gmail.com.

Reply via email to